mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 03:02:15 +01:00
fix tests, add autofocus disable option for dropdown
This commit is contained in:
@@ -5,18 +5,23 @@ const props = withDefaults(
|
||||
defineProps<{
|
||||
align?: 'center' | 'end' | 'start';
|
||||
closeOnContentClick?: boolean;
|
||||
autoFocus?: boolean;
|
||||
}>(),
|
||||
{
|
||||
align: 'start',
|
||||
closeOnContentClick: true,
|
||||
autoFocus: true,
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['open', 'submit']);
|
||||
const open = defineModel({ default: false });
|
||||
|
||||
|
||||
|
||||
function handleAutofocus(event: Event) {
|
||||
if (props.autoFocus === false) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function onContentClick() {
|
||||
if (props.closeOnContentClick === true) {
|
||||
@@ -42,6 +47,7 @@ function onOpenChange(value: boolean) {
|
||||
<PopoverContent
|
||||
:align="align"
|
||||
class="rounded-lg overflow-hidden relative border border-card-border overflow-none shadow-dropdown bg-card-background"
|
||||
@open-auto-focus="handleAutofocus"
|
||||
@click="onContentClick">
|
||||
<slot name="content" />
|
||||
</PopoverContent>
|
||||
|
||||
Reference in New Issue
Block a user