Skip to content

Commit 6c86208

Browse files
authored
Merge pull request #182 from joyofrails/fix/syntax-highlight-select-focus
Remove error prone auto focus from syntax preview
2 parents 9f59109 + 2d20397 commit 6c86208

File tree

1 file changed

+0
-10
lines changed
  • app/javascript/controllers/syntax-highlight

1 file changed

+0
-10
lines changed

app/javascript/controllers/syntax-highlight/preview.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import debug from '../../utils/debug';
44

55
const console = debug('app:javascript:controllers:syntax-highlight:preview');
66

7-
let submitting = false;
8-
97
export default class extends Controller {
108
static values = {
119
name: String, // The name of the syntax highlight css file to enable
@@ -26,19 +24,11 @@ export default class extends Controller {
2624
});
2725
link.disabled = name !== link.dataset.syntaxHighlight;
2826
});
29-
30-
if (submitting) {
31-
this.selectTarget.focus();
32-
submitting = false;
33-
}
3427
}
3528

3629
change(event) {
3730
if (event.target.form) {
3831
event.target.form.requestSubmit();
39-
40-
// This is some hacky module state so that we can retain the focus on the re-rendered select element after a submit
41-
submitting = true;
4232
}
4333
}
4434
}

0 commit comments

Comments
 (0)