Skip to content

refactor(tooltip): Use pointer events in favor of mouse events #5320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2022

Conversation

driskull
Copy link
Member

Related Issue: #5318

Summary

refactor(tooltip): Use pointer events in favor of mouse events. (#5318)

pointer events will fire on disabled elements.

pointer events will fire on disabled elements.
@github-actions github-actions bot added the refactor Issues tied to code that needs to be significantly reworked. label Sep 14, 2022
@driskull
Copy link
Member Author

driskull commented Sep 14, 2022

@jcfranco I think these code changes make sense. However, because we disable pointer events on our disabled elements the tooltips will still not show. This does fix the issue for disabled native buttons though.

@jcfranco Do you think we should try and support tooltips on our disabled elements?

test

@driskull driskull marked this pull request as ready for review September 14, 2022 21:11
@driskull driskull requested a review from a team as a code owner September 14, 2022 21:11
@driskull driskull requested a review from jcfranco September 14, 2022 21:12
@jcfranco
Copy link
Member

Do you think we should try and support tooltips on our disabled elements?

@darrenDoesntCode @ashetland @SkyeSeitz @geospatialem WDYT?

@ashetland
Copy link
Contributor

ashetland commented Sep 14, 2022

Do you think we should try and support tooltips on our disabled elements?

@darrenDoesntCode @ashetland @SkyeSeitz @geospatialem WDYT?

Definitely useful, especially if the tooltip can tell me why it's disabled.

@macandcheese
Copy link
Contributor

Hm, I'm not sure I would expect a disabled component to be interactive at all. I might expect another, not disabled UI element to invoke the tooltip. There are likely screenreader implications here to consider.

@geospatialem
Copy link
Member

Tested with NVDA and JAWS, and the disabled context isn't provided to them, which is the expectation with assistive technology.

However, if implemented, this might be a case where we're providing content to some users, but not all. Not ideal to accommodate a larger audience.

As Adam mentioned there could be another, non-disabled UI element that could invoke the tooltip for these use cases instead.

@driskull
Copy link
Member Author

The native button and native tooltip still work when the button is disabled.

Screen Shot 2022-09-14 at 3 35 50 PM

https://codepen.io/driskull/pen/yLjVWVK?editors=1000

@geospatialem
Copy link
Member

The native button and native tooltip still work when the button is disabled.

Ah, thanks for the context! If that's the native behavior, then makes sense to proceed. 👍🏻

@ashetland
Copy link
Contributor

The native button and native tooltip still work when the button is disabled.

Screen Shot 2022-09-14 at 3 35 50 PM

https://codepen.io/driskull/pen/yLjVWVK?editors=1000

I knew I had seen this somewhere!

@macandcheese
Copy link
Contributor

I still am not sure the tooltip should be invoked. Sometimes tooltips are just the name of button / action, but they are also used to contain descriptive or supplementary text, and only making that available via hover (and not focus, or click) seems weird.

I think it’s valid to maintain the native functionality of showing a label on hover, but to me a label and tooltip are not totally the same.

@jcfranco
Copy link
Member

I think it’s valid to maintain the native functionality of showing a label on hover, but to me a label and tooltip are not totally the same.

@macandcheese Agreed, but that sounds like that will be up to the developers since we wouldn't use title + calcite-tooltip (a), but rather just calcite-tooltips for both use cases (b), right? If we're all in agreement w/ b, this PR is good to go!

BTW, I'm assuming you used label to mean native tooltip, but please correct me if you meant something else.

@driskull
Copy link
Member Author

I think this PR is good to go regardless as it just changes from mouse to pointer events.

If we want to remove the pointer-events:none on our disabled calcite-button that would be the part that allows our tooltips on our disabled buttons.

@jcfranco
Copy link
Member

Good point. Moving forward!

WRT allowing tooltips on disabled components, let me know if y'all prefer an issue or discussion.

Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

🐭👈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants