Skip to content

fix(evo-tooltip): open on click in browsers that do not focus buttons on click - #884

Open
LuLaValva wants to merge 1 commit into
mainfrom
llavalva-M451495HWX-evo-compact-icon-examples-rb8fdd-tooltip-focus
Open

fix(evo-tooltip): open on click in browsers that do not focus buttons on click#884
LuLaValva wants to merge 1 commit into
mainfrom
llavalva-M451495HWX-evo-compact-icon-examples-rb8fdd-tooltip-focus

Conversation

@LuLaValva

Copy link
Copy Markdown
Member

evo-tooltip opens on focusin, but Safari and macOS Firefox do not give buttons focus on click — so a noHover tooltip with a button host could only be opened with the keyboard. The host element now focuses itself on click (a no-op where click already focuses), composing with any consumer-provided onClick. Adds the component's first browser tests, using programmatic clicks to reproduce the no-focus-on-click behavior, plus a changeset.

🤖 Generated with Claude Code

… on click

Safari and macOS Firefox do not give buttons focus on click, and the
tooltip only opens on focusin, so a noHover tooltip with a button host
could not be opened with a pointer. The host now focuses itself on
click, composing with any consumer-provided onClick.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 00:42
@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17d5c46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evo-web/marko Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates evo-tooltip (Marko) so noHover tooltips can open on mouse click in browsers that don’t automatically focus <button> elements on click (notably Safari and macOS Firefox). It does this by focusing the tooltip host within the click handler while preserving any consumer-provided onClick, and adds the component’s first browser tests plus a patch changeset.

Changes:

  • Compose a host onClick handler that calls el.focus() before invoking any consumer-provided onClick.
  • Add new browser tests (and a fixture) validating open-on-click and close-on-blur behavior for a button host.
  • Add a patch changeset for @evo-web/marko.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/evo-marko/src/tags/evo-tooltip/index.marko Focus host on click and compose with consumer onClick to ensure click opens the tooltip in non-focus-on-click browsers.
packages/evo-marko/src/tags/evo-tooltip/test/test.browser.ts New browser tests for open-on-click and close-on-blur behavior.
packages/evo-marko/src/tags/evo-tooltip/test/fixtures/button-host.marko New fixture rendering a noHover tooltip with a button host and optional click handler.
.changeset/tall-tooltips-focus.md Patch changeset documenting the Safari/macOS Firefox behavior fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1 to +3
export interface Input {
onHostClick?: Marko.HTML.Span["onClick"];
}

afterEach(cleanup);

const settle = () => new Promise((resolve) => setTimeout(resolve, 50));

@HenriqueLimas HenriqueLimas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure we want this behavior for clicks of buttons. Reason is that after clicking the button its too late to see the tooltip IMO.

@github-actions

Copy link
Copy Markdown
Contributor

PR Preview Deployed

Websiteevo-markoevo-reactebayui-coreebayui-core-reactskin

commit 17d5c46

@LuLaValva

Copy link
Copy Markdown
Member Author

Not sure we want this behavior for clicks of buttons. Reason is that after clicking the button its too late to see the tooltip IMO.

I think it depends on the purpose of the button! If the result is a reversible action then it is still useful to see the button's tooltip.

This change irons out an inconsistency between browsers. Only Safari doesn't trigger a focus event on button click, so the tooltip opens everywhere else. I think it's worth it to make all browsers behave the same.

@HenriqueLimas

HenriqueLimas commented Aug 13, 2026

Copy link
Copy Markdown
Member

What if Safari is the correct approach? Other libraries like react-aria or base-ui, they both show the tooltip only on focus if hover is disabled. If we consider this sentence from our MIND patterns:

Tooltip should follow the principal of progressive disclosure - revealing the right information, at the right time.

Showing it on click its not at the right time IMO, its too late already and unecessary.

If we consider safari is the correct approach, we need to detect mousedown first and abort the tooltip to open when that happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants