Skip to content

Commit 9a1bfb3

Browse files
committed
Fixup RTL track clicking
1 parent a87f6c4 commit 9a1bfb3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/@react-aria/slider/src/useSlider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ export function useSlider(
114114
const trackPosition = trackRef.current.getBoundingClientRect().left;
115115
const clickPosition = e.clientX;
116116
const offset = clickPosition - trackPosition;
117-
const percent = offset / trackRef.current.offsetWidth;
118-
let value = state.getPercentValue(percent);
117+
let percent = offset / trackRef.current.offsetWidth;
119118
if (direction === 'rtl') {
120-
value = 100 - value;
119+
percent = 1 - percent;
121120
}
121+
const value = state.getPercentValue(percent);
122122

123123
// Only compute the diff for thumbs that are editable, as only they can be dragged
124124
const minDiff = Math.min(...state.values.map((v, index) => state.isThumbEditable(index) ? Math.abs(v - value) : Number.POSITIVE_INFINITY));

packages/@react-aria/splitview/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
},
2020
"dependencies": {
2121
"@babel/runtime": "^7.6.2",
22+
"@react-aria/interactions": "3.2.0",
2223
"@react-aria/utils": "^3.1.0",
23-
"@react-types/shared": "^3.1.0",
24-
"@react-stately/splitview": "^3.0.0-alpha.1"
24+
"@react-stately/splitview": "^3.0.0-alpha.1",
25+
"@react-types/shared": "^3.1.0"
2526
},
2627
"peerDependencies": {
2728
"react": "^16.8.0"

0 commit comments

Comments
 (0)