Fixed: Tag inputs respect non-QWERTY layouts
This commit is contained in:
parent
1b3839ac0d
commit
638066db03
|
@ -135,7 +135,7 @@ class FilterBuilderRowValue extends Component {
|
||||||
tagList={tagList}
|
tagList={tagList}
|
||||||
allowNew={!tagList.length}
|
allowNew={!tagList.length}
|
||||||
kind={kinds.DEFAULT}
|
kind={kinds.DEFAULT}
|
||||||
delimiters={[9, 13]}
|
delimiters={['Tab', 'Enter']}
|
||||||
maxSuggestionsLength={100}
|
maxSuggestionsLength={100}
|
||||||
minQueryLength={0}
|
minQueryLength={0}
|
||||||
tagComponent={FilterBuilderRowValueTag}
|
tagComponent={FilterBuilderRowValueTag}
|
||||||
|
|
|
@ -100,9 +100,9 @@ class TagInput extends Component {
|
||||||
suggestions
|
suggestions
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const keyCode = event.keyCode;
|
const key = event.key;
|
||||||
|
|
||||||
if (keyCode === 8 && !value.length) {
|
if (key === 'Backspace' && !value.length) {
|
||||||
const index = tags.length - 1;
|
const index = tags.length - 1;
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -116,7 +116,7 @@ class TagInput extends Component {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delimiters.includes(keyCode)) {
|
if (delimiters.includes(key)) {
|
||||||
const selectedIndex = this._autosuggestRef.highlightedSuggestionIndex;
|
const selectedIndex = this._autosuggestRef.highlightedSuggestionIndex;
|
||||||
const tag = getTag(value, selectedIndex, suggestions, allowNew);
|
const tag = getTag(value, selectedIndex, suggestions, allowNew);
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ TagInput.propTypes = {
|
||||||
allowNew: PropTypes.bool.isRequired,
|
allowNew: PropTypes.bool.isRequired,
|
||||||
kind: PropTypes.oneOf(kinds.all).isRequired,
|
kind: PropTypes.oneOf(kinds.all).isRequired,
|
||||||
placeholder: PropTypes.string.isRequired,
|
placeholder: PropTypes.string.isRequired,
|
||||||
delimiters: PropTypes.arrayOf(PropTypes.number).isRequired,
|
delimiters: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
minQueryLength: PropTypes.number.isRequired,
|
minQueryLength: PropTypes.number.isRequired,
|
||||||
hasError: PropTypes.bool,
|
hasError: PropTypes.bool,
|
||||||
hasWarning: PropTypes.bool,
|
hasWarning: PropTypes.bool,
|
||||||
|
@ -275,8 +275,7 @@ TagInput.defaultProps = {
|
||||||
allowNew: true,
|
allowNew: true,
|
||||||
kind: kinds.INFO,
|
kind: kinds.INFO,
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
// Tab, enter, space and comma
|
delimiters: ['Tab', 'Enter', ' ', ','],
|
||||||
delimiters: [9, 13, 32, 188],
|
|
||||||
minQueryLength: 1,
|
minQueryLength: 1,
|
||||||
tagComponent: TagInputTag
|
tagComponent: TagInputTag
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,8 +13,7 @@ import FormLabel from 'Components/Form/FormLabel';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import styles from './EditReleaseProfileModalContent.css';
|
import styles from './EditReleaseProfileModalContent.css';
|
||||||
|
|
||||||
// Tab, enter, and comma
|
const tagInputDelimiters = ['Tab', 'Enter', ','];
|
||||||
const tagInputDelimiters = [9, 13, 188];
|
|
||||||
|
|
||||||
function EditReleaseProfileModalContent(props) {
|
function EditReleaseProfileModalContent(props) {
|
||||||
const {
|
const {
|
||||||
|
|
Loading…
Reference in New Issue