Skip to content
Snippets Groups Projects
Unverified Commit fc1e1cce authored by chrisgarrity's avatar chrisgarrity Committed by GitHub
Browse files

Merge pull request #3626 from LLK/revert-3583-issue/3302-language-focus

Revert "Blur language select focus when mouse leaves"
parents e1a419dd d0108cd6
No related branches found
No related tags found
No related merge requests found
......@@ -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}
>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment