Skip to content

Commit

Permalink
Shortcuts: respect data-enabled-shortcuts if it's specified [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed Apr 20, 2021
1 parent 49474f7 commit 473d554
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,12 @@ export default class Select extends Component {
placeholder={this.props.inputPlaceholder}
onKeyDown={this.props.onKeyDown}
data-test="ring-select__focus"
enableShortcuts={shortcutsEnabled
? Object.keys({
...this.getShortcutsMap(),
...this._popup?.list?.shortcutsMap
})
: undefined}
/>
{this.props.type === Type.INPUT && iconsNode}
{this._renderPopup()}
Expand Down
6 changes: 3 additions & 3 deletions components/shortcuts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ class Shortcuts {
if (
element === document ||
element.matches(this.ALLOW_SHORTCUTS_SELECTOR) ||
element.closest(this.ALLOW_SHORTCUTS_SELECTOR) ||
element.dataset.enabledShortcuts != null &&
element.dataset.enabledShortcuts.split(',').includes(key)
(element.dataset.enabledShortcuts != null
? element.dataset.enabledShortcuts.split(',').includes(key)
: element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null)
) {
return false;
}
Expand Down

0 comments on commit 473d554

Please sign in to comment.