Skip to content

Commit

Permalink
fix(#122): use unique IDs for tooltips
Browse files Browse the repository at this point in the history
fix: #122
  • Loading branch information
BearToCode committed Oct 26, 2024
1 parent 67220bc commit 906278e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/carta-md/src/lib/internal/components/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
let mounted = false;
let prevValue = value;
const simpleUUID = Math.random().toString(36).substring(2);
/**
* Manually resize the textarea to fit the content, so that it
* always perfectly overlaps the highlighting overlay.
Expand Down Expand Up @@ -154,7 +156,12 @@
});
</script>

<div role="tooltip" id="editor-unfocus-suggestion" style="display: {hidden ? 'none' : 'unset'};">
<div
role="tooltip"
class="editor-unfocus-suggestion"
id="editor-unfocus-suggestion-{simpleUUID}"
style="display: {hidden ? 'none' : 'unset'};"
>
Press ESC then TAB to move the focus off the field
</div>
<div
Expand All @@ -181,7 +188,7 @@
spellcheck="false"
class="carta-font-code"
aria-multiline="true"
aria-describedby="editor-unfocus-suggestion"
aria-describedby="editor-unfocus-suggestion-{simpleUUID}"
tabindex="0"
{placeholder}
{...props}
Expand Down Expand Up @@ -260,7 +267,7 @@
word-break: break-word;
}
#editor-unfocus-suggestion {
.editor-unfocus-suggestion {
position: absolute;
width: 1px;
height: 1px;
Expand Down

0 comments on commit 906278e

Please sign in to comment.