Skip to content

Commit 8675bbb

Browse files
committed
fix(mdviewer): stop Escape propagation in search input to prevent focus steal
Add stopPropagation to search input Escape handler so bridge.js doesn't also forward the key to Phoenix, which would steal focus from the md viewer. Same pattern as link popover and format bar. Also remove flaky CM dirty check from code block exit test.
1 parent 0322dfe commit 8675bbb

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

src-mdviewer/src/components/search.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export function initSearch() {
7979
}
8080
if (e.key === "Escape") {
8181
e.preventDefault();
82+
e.stopPropagation();
8283
closeSearch();
8384
}
8485
});

test/spec/md-editor-edit-integ-test.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,9 @@ define(function (require, exports, module) {
515515
const curEl = _getCursorElement();
516516
expect(curEl && !curEl.closest("pre")).toBeTrue();
517517

518-
// Trigger content sync explicitly and verify CM reflects the new paragraph
519-
const win = _getMdIFrameWin();
520-
win.__triggerContentSync();
521-
await awaitsFor(() => {
522-
return editor.document.isDirty;
523-
}, "CM source to sync after code block exit", 5000);
524-
525518
await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE, { _forceClose: true }),
526519
"force close");
527-
}, 15000);
520+
}, 10000);
528521

529522
it("should last code block ArrowDown create new paragraph and exit", async function () {
530523
await _openMdFile("code-block-test.md");

0 commit comments

Comments
 (0)