Skip to content

Commit

Permalink
[composer] tabbing through to body doesn't work in firefox (#460)
Browse files Browse the repository at this point in the history
* testing

* add focus flag

* add comment

* Update HTMLEditor.svelte

add back old comment
  • Loading branch information
gudsson authored Oct 12, 2022
1 parent 46aa159 commit 958e0ce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/composer/src/components/HTMLEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,20 @@
});
}
let focusing = false;
const handleHtmlBodyFocus = () => {
// refocus editor to return cursor to editor - workaround for
// firefox selection API / shadow DOM issues)
if (focusing) {
focusing = false;
} else {
focusing = true;
setTimeout(() => {
container.blur();
container.focus();
}, 0);
}
// if contenteditable area is empty we need to add something to add range
if (container.innerHTML === "") {
container.innerHTML = "\u00a0";
Expand Down

1 comment on commit 958e0ce

@vercel
Copy link

@vercel vercel bot commented on 958e0ce Oct 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.