Skip to content

Commit eb790ba

Browse files
committed
fix(ui-modal): remove tabbability from modalBody if there is no scrollbar
INSTUI-4648
1 parent eed72ca commit eb790ba

File tree

1 file changed

+4
-8
lines changed
  • packages/ui-modal/src/Modal/ModalBody

1 file changed

+4
-8
lines changed

packages/ui-modal/src/Modal/ModalBody/index.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,10 @@ class ModalBody extends Component<ModalBodyProps> {
113113
as={as}
114114
css={this.props.styles?.modalBody}
115115
padding={padding}
116-
// Setting this to 0 is necessary for findFocusable to find this DOM
117-
// element.
118-
// Note that VoiceOver does not read the contents properly
119-
// if there is a scrollbar, and it has no kb just SR focus.
120-
// To prevent this we could set tabIndex to -1
121-
// but this would make the scrollbar non-focusable, so the modal cannot
122-
// be scrolled with keyboard.
123-
tabIndex={0}
116+
//check if there is a scrollbar, if so, the element has to be tabbable to be able to scroll with keyboard only
117+
{...(this.ref?.scrollHeight !== this.ref?.getBoundingClientRect().height
118+
? { tabIndex: 0 }
119+
: {})}
124120
>
125121
{children}
126122
</View>

0 commit comments

Comments
 (0)