Skip to content

Commit

Permalink
fix(shared): prevent global keydown
Browse files Browse the repository at this point in the history
This fixes a regression introduced via a6dfc16.

The prior change switched to `onKeyDown`, which is an synthetic
event handler that cannot prevent default (on global clicks).

What we need to prevent default (global) clicks is actual DOM event
handling. Quoting from the Inferno documentation [1]:

> Lower case events will bypass Inferno's event system in favour of
> using the native event system supplied by the browser.

[1]: https://www.infernojs.org/docs/guides/event-handling
  • Loading branch information
nikku committed Oct 16, 2024
1 parent b36d2f6 commit d452c8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/dmn-js-shared/src/components/ContentEditable.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default class ContentEditable extends Component {
}
};

onKeydown = (event) => {
onkeydown = (event) => {

// enter
if (event.which === 13) {
Expand Down Expand Up @@ -182,7 +182,7 @@ export default class ContentEditable extends Component {
};

// TODO(barmac): remove once we drop IE 11 support
onKeyPress = (event) => {
onkeypress = (event) => {
if (this.onInputIEPolyfill) {
this.onInputIEPolyfill(event);
}
Expand Down Expand Up @@ -243,11 +243,11 @@ export default class ContentEditable extends Component {
spellCheck="false"
data-placeholder={ placeholder || '' }
onInput={ this.onInput }
onKeyPress={ this.onKeypress }
onkeypress={ this.onkeypress }
onPaste={ this.onPaste }
onFocus={ this.onFocus }
onBlur={ this.onBlur }
onKeyDown={ this.onKeydown }
onkeydown={ this.onkeydown }
ref={ node => this.node = node }
dangerouslySetInnerHTML={ { __html: value } }></div>
);
Expand Down

0 comments on commit d452c8a

Please sign in to comment.