Merge pull request #3626 from LLK/revert-3583-issue/3302-language-focus
Revert "Blur language select focus when mouse leaves"
This commit is contained in:
2 files changed
+2
-26
No files matched your search
@@ -7,11 +7,10 @@ import styles from './language-selector.css';
|
||||
// supported languages to exclude from the menu, but allow as a URL option
|
||||
const ignore = [];
|
||||
|
||||
const LanguageSelector = ({componentRef, currentLocale, label, onChange}) => (
|
||||
const LanguageSelector = ({currentLocale, label, onChange}) => (
|
||||
<select
|
||||
aria-label={label}
|
||||
className={styles.languageSelect}
|
||||
ref={componentRef}
|
||||
value={currentLocale}
|
||||
onChange={onChange}
|
||||
>
|
||||
@@ -31,7 +30,6 @@ const LanguageSelector = ({componentRef, currentLocale, label, onChange}) => (
|
||||
);
|
||||
|
||||
LanguageSelector.propTypes = {
|
||||
componentRef: PropTypes.func,
|
||||
currentLocale: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
onChange: PropTypes.func
|
||||
|
||||
@@ -11,31 +11,10 @@ class LanguageSelector extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
bindAll(this, [
|
||||
'handleChange',
|
||||
'handleMouseOut',
|
||||
'ref'
|
||||
'handleChange'
|
||||
]);
|
||||
document.documentElement.lang = props.currentLocale;
|
||||
}
|
||||
componentDidMount () {
|
||||
this.addListeners();
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
this.removeListeners();
|
||||
}
|
||||
addListeners () {
|
||||
this.select.addEventListener('mouseout', this.handleMouseOut);
|
||||
}
|
||||
removeListeners () {
|
||||
this.select.removeEventListener('mouseout', this.handleMouseOut);
|
||||
}
|
||||
handleMouseOut () {
|
||||
this.select.blur();
|
||||
}
|
||||
ref (c) {
|
||||
this.select = c;
|
||||
}
|
||||
handleChange (e) {
|
||||
const newLocale = e.target.value;
|
||||
if (this.props.messagesByLocale[newLocale]) {
|
||||
@@ -52,7 +31,6 @@ class LanguageSelector extends React.Component {
|
||||
} = this.props;
|
||||
return (
|
||||
<LanguageSelectorComponent
|
||||
componentRef={this.ref}
|
||||
onChange={this.handleChange}
|
||||
{...props}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user