Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/src/components/select.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
background-color: var(--button-secondary-base);
}
&[data-variant="ghost"] {
background-color: transparent;
background-color: var(--surface-raised-base-hover);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the variant is called "ghost" so I can see why it was transparent but having a transparent hover focus bg-color doesn't make sense unless the color transitions from color X -> transparent on focus (with a visible delta)

Blast radius

Selects that use "ghost" variant (disclaimer: search obtained via GPT 5.2 Codex xhigh) :

  1. Bonus bug in recording:
  2. Primary bug from recording:

}
&[data-variant="primary"] {
background-color: var(--icon-strong-base);
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export function Tooltip(props: TooltipProps) {
onMount(() => {
const childElements = c()
if (childElements instanceof HTMLElement) {
childElements.addEventListener("focus", () => setOpen(true))
childElements.addEventListener("blur", () => setOpen(false))
childElements.addEventListener("focusin", () => setOpen(true))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

focusin reference https://developer.mozilla.org/en-US/docs/Web/API/Element/focusin_event

the main delta is bubbling, which is what is fixing the issue

The risk of changing these all to bubble is that if focus can jump between two descendants of "childElements" the tooltip may possibly flicker

for ex node of: tooltip(div(btn1, btn2)), tabbing between btn1 and btn2 could possibly flicker when these events run, haven't reproed it but I don't think the risk is high enough to warrant not using these event listeners.

The pros of getting better tooltip render for focused children is worth the possible flicker when focus shifts IMO.

childElements.addEventListener("focusout", () => setOpen(false))
} else if (Array.isArray(childElements)) {
for (const child of childElements) {
if (child instanceof HTMLElement) {
child.addEventListener("focus", () => setOpen(true))
child.addEventListener("blur", () => setOpen(false))
child.addEventListener("focusin", () => setOpen(true))
child.addEventListener("focusout", () => setOpen(false))
}
}
}
Expand Down