diff --git a/src/web/utils/statusBar.mjs b/src/web/utils/statusBar.mjs index 454b36b0..0e85e0b5 100644 --- a/src/web/utils/statusBar.mjs +++ b/src/web/utils/statusBar.mjs @@ -82,24 +82,24 @@ class StatusBarPanel { * @param {Event} e */ showDropUp(e) { - if (e.type === "click" || e.keyCode === 13) { + if (e.type === "click" || e.key === 'Enter'|| e.key === ' ') { const el = e.target .closest(".cm-status-bar-select") .querySelector(".cm-status-bar-select-content"); const btn = e.target.closest(".cm-status-bar-select-btn"); - if (btn.classList.contains("disabled")) return; + if (btn.classList.contains("disabled")) return; - el.classList.add("show"); + el.classList.add("show"); - // Focus the filter input if present - const filter = el.querySelector(".cm-status-bar-filter-input"); - if (filter) filter.focus(); + // Focus the filter input if present + const filter = el.querySelector(".cm-status-bar-filter-input"); + if (filter) filter.focus(); - // Set up a listener to close the menu if the user clicks outside of it - hideOnClickOutside(el, e); - // Set up a listener to close the menu if the user presses key outside of it - hideOnMoveFocus(el, e); + // Set up a listener to close the menu if the user clicks outside of it + hideOnClickOutside(el, e); + // Set up a listener to close the menu if the user presses key outside of it + hideOnMoveFocus(el, e); } } @@ -181,8 +181,7 @@ class StatusBarPanel { // CodeMirror always counts line breaks as one character. // We want to show an accurate reading of how many bytes there are. if (state.lineBreak.length !== 1) { - docLength += - state.lineBreak.length * state.doc.lines - state.doc.lines - 1; + docLength += (state.lineBreak.length * state.doc.lines) - state.doc.lines - 1; } length.textContent = docLength; lines.textContent = state.doc.lines; @@ -237,6 +236,7 @@ class StatusBarPanel { } } + /** * Sets the current EOL separator in the status bar * @param {EditorState} state @@ -344,7 +344,7 @@ class StatusBarPanel { */ constructLHS() { return ` - + abc @@ -386,13 +386,13 @@ class StatusBarPanel { } return ` -