Skip to content

Commit 8884572

Browse files
committed
fix: modal aria error
1 parent b0d9309 commit 8884572

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

components/vc-dialog/Content.tsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getTransitionProps } from '../_util/transition';
55
import dialogPropTypes from './IDialogPropTypes';
66
import { offset } from './util';
77
const sentinelStyle = { width: 0, height: 0, overflow: 'hidden', outline: 'none' };
8-
8+
const entityStyle = { outline: 'none' };
99
export type ContentRef = {
1010
focus: () => void;
1111
changeActive: (next: boolean) => void;
@@ -28,14 +28,14 @@ export default defineComponent({
2828
const dialogRef = ref<HTMLDivElement>();
2929
expose({
3030
focus: () => {
31-
sentinelStartRef.value?.focus();
31+
sentinelStartRef.value?.focus({ preventScroll: true });
3232
},
3333
changeActive: next => {
3434
const { activeElement } = document;
3535
if (next && activeElement === sentinelEndRef.value) {
36-
sentinelStartRef.value.focus();
36+
sentinelStartRef.value.focus({ preventScroll: true });
3737
} else if (!next && activeElement === sentinelStartRef.value) {
38-
sentinelEndRef.value.focus();
38+
sentinelEndRef.value.focus({ preventScroll: true });
3939
}
4040
},
4141
});
@@ -143,9 +143,10 @@ export default defineComponent({
143143
onMousedown={onMousedown}
144144
onMouseup={onMouseup}
145145
>
146-
<div tabindex={0} ref={sentinelStartRef} style={sentinelStyle} inert/>
147-
{modalRender ? modalRender({ originVNode: content }) : content}
148-
<div tabindex={0} ref={sentinelEndRef} style={sentinelStyle} inert/>
146+
<div tabindex={0} ref={sentinelStartRef} style={entityStyle}>
147+
{modalRender ? modalRender({ originVNode: content }) : content}
148+
</div>
149+
<div tabindex={0} ref={sentinelEndRef} style={sentinelStyle} />
149150
</div>
150151
) : null}
151152
</Transition>

0 commit comments

Comments
 (0)