mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
blur focused element in a screen when it is under a modal
This commit is contained in:
parent
196267f7f8
commit
d2dd49a832
1 changed files with 9 additions and 0 deletions
|
|
@ -28,6 +28,15 @@ class FocusableProvider extends Component {
|
|||
nextState.focusable !== this.state.focusable;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
if (!this.state.focusable) {
|
||||
const focusedElement = this.childElementRef.current.querySelector(':focus');
|
||||
if (focusedElement) {
|
||||
focusedElement.blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
containerClildListOnChange = () => {
|
||||
this.setState({ focusable: this.childElementRef.current.nextElementSibling === null });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue