Skip to content

Commit 06614eb

Browse files
authored
Merge branch 'master' into bugfix-menuShouldBlockScroll-prop
2 parents 120a82c + 052e864 commit 06614eb

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

packages/react-select/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# react-select
22

3+
## 5.10.2
4+
5+
### Patch Changes
6+
7+
- [`bf0c8615`](https://github.com/JedWatson/react-select/commit/bf0c8615f8574264883f984c0d2ff36ff9dcdcb7) [#6051](https://github.com/JedWatson/react-select/pull/6051) Thanks [@jnyholm-sc](https://github.com/jnyholm-sc)! - fix: hydration problem caused by isAppleDevice
8+
39
## 5.10.1
410

511
### Patch Changes

packages/react-select/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-select",
3-
"version": "5.10.1",
3+
"version": "5.10.2",
44
"description": "A Select control built with and for ReactJS",
55
"main": "dist/react-select.cjs.js",
66
"module": "dist/react-select.esm.js",

packages/react-select/src/Select.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ interface State<
340340
inputIsHiddenAfterUpdate: boolean | null | undefined;
341341
prevProps: Props<Option, IsMulti, Group> | void;
342342
instancePrefix: string;
343+
isAppleDevice: boolean;
343344
}
344345

345346
interface CategorizedOption<Option> {
@@ -644,6 +645,7 @@ export default class Select<
644645
inputIsHiddenAfterUpdate: undefined,
645646
prevProps: undefined,
646647
instancePrefix: '',
648+
isAppleDevice: false,
647649
};
648650

649651
// Misc. Instance Properties
@@ -657,7 +659,6 @@ export default class Select<
657659
openAfterFocus = false;
658660
scrollToFocusedOptionOnUpdate = false;
659661
userIsDragging?: boolean;
660-
isAppleDevice = isAppleDevice();
661662

662663
// Refs
663664
// ------------------------------
@@ -815,6 +816,10 @@ export default class Select<
815816
) {
816817
scrollIntoView(this.menuListRef, this.focusedOptionRef);
817818
}
819+
if (isAppleDevice()) {
820+
// eslint-disable-next-line react/no-did-mount-set-state
821+
this.setState({ isAppleDevice: true });
822+
}
818823
}
819824
componentDidUpdate(prevProps: Props<Option, IsMulti, Group>) {
820825
const { isDisabled, menuIsOpen } = this.props;
@@ -1724,7 +1729,7 @@ export default class Select<
17241729
'aria-labelledby': this.props['aria-labelledby'],
17251730
'aria-required': required,
17261731
role: 'combobox',
1727-
'aria-activedescendant': this.isAppleDevice
1732+
'aria-activedescendant': this.state.isAppleDevice
17281733
? undefined
17291734
: this.state.focusedOptionId || '',
17301735

@@ -1995,7 +2000,7 @@ export default class Select<
19952000
onMouseOver: onHover,
19962001
tabIndex: -1,
19972002
role: 'option',
1998-
'aria-selected': this.isAppleDevice ? undefined : isSelected, // is not supported on Apple devices
2003+
'aria-selected': this.state.isAppleDevice ? undefined : isSelected, // is not supported on Apple devices
19992004
};
20002005

20012006
return (
@@ -2188,7 +2193,7 @@ export default class Select<
21882193
isFocused={isFocused}
21892194
selectValue={selectValue}
21902195
focusableOptions={focusableOptions}
2191-
isAppleDevice={this.isAppleDevice}
2196+
isAppleDevice={this.state.isAppleDevice}
21922197
/>
21932198
);
21942199
}

0 commit comments

Comments
 (0)