Skip to content

Commit 5ae1f42

Browse files
matyasfclaude
andcommitted
fix(ui-modal): adjust scrollbar detection tolerance in ModalBody
Increase epsilon tolerance from 0.05 to 1 pixel to avoid false positives when detecting scrollbars due to browser rounding errors. This prevents unnecessary tabIndex=0 from being applied when no scrollbar is present. Fixes INSTUI-4863 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f23269e commit 5ae1f42

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ class ModalBody extends Component<ModalBodyProps> {
130130
css={this.props.styles?.modalBody}
131131
padding={padding}
132132
// check if there is a scrollbar, if so, the element has to be tabbable to be able to scroll with keyboard only
133-
// epsilon tolerance is used to avoid false positives, this is generally safer than Math rounding techniques
133+
// epsilon tolerance is used to avoid scrollbar for rounding errors
134134
{...(finalRef &&
135135
Math.abs(
136136
(finalRef.scrollHeight ?? 0) -
137137
(finalRef.getBoundingClientRect()?.height ?? 0)
138-
) > 0.05
138+
) > 1
139139
? { tabIndex: 0 }
140140
: {})}
141141
>

0 commit comments

Comments
 (0)