Skip to content
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

Prevent default/stop propagation on Tooltip.disclosure click #1476

Merged
merged 9 commits into from
Aug 24, 2023

Conversation

caseyWebb
Copy link
Member

@caseyWebb caseyWebb commented Aug 22, 2023

🔧 Modifying a component

Context

This PR changes the default click behavior for disclosure tooltips to preventDefault and stopPropagation on click. This allows nesting Tooltips within clickable regions such.

https://noredink.slack.com/archives/C02NVG4M45U/p1692639132232799

Closes KRA-1114

Component completion checklist

  • I've gone through the relevant sections of the Development Accessibility guide with the changes I made to this component in mind
  • Changes are clearly documented
    • Component docs include a changelog
    • Any new exposed functions or properties have docs
  • Changes extend to the Component Catalog
    • The Component Catalog is updated to use the newest version, if appropriate
    • The Component Catalog example version number is updated, if appropriate
    • Any new customizations are available from the Component Catalog
    • The component example still has:
      • an accurate preview
      • valid sample code
      • correct keyboard behavior
      • correct and comprehensive guidance around how to use the component
  • Changes to the component are tested/the new version of the component is tested
  • Component API follows standard patterns in noredink-ui
    • e.g., as a dev, I can conveniently add an nriDescription
    • and adding a new feature to the component will not require major API changes to the component
  • If this is a new major version of the component, our team has stories created to upgrade all instances of the old component. Here are links to the stories:
    • not a major version

@caseyWebb caseyWebb requested review from tesk9, a team and charbelrami and removed request for tesk9 and a team August 22, 2023 02:05
@caseyWebb caseyWebb marked this pull request as draft August 22, 2023 13:44
@caseyWebb caseyWebb removed the request for review from charbelrami August 22, 2023 13:44
@caseyWebb caseyWebb requested review from a team and tesk9 and removed request for a team August 22, 2023 15:36
@caseyWebb caseyWebb marked this pull request as ready for review August 22, 2023 15:37
Copy link
Contributor

@tesk9 tesk9 left a comment

Choose a reason for hiding this comment

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

Code looks good!

Could you please finish filling out the checklist, though? thanks!

@bcardiff
Copy link
Member

I think all the remaining checkboxes can be checked at this point.

elm-explorations unfortunately does not emulates even bubbling. It's impossible to elm-test the actual behaviour.
While pairing on this I thought that adding some behavioral/puppeteer(?) specs would be best. But we would need a small custom app to do that.

I don't think is mandatory for this PR to address that, but might be good to have some direction to have that kind of test. puppeteer/playwright/cypress. WDYT @tesk9 ?

@tesk9
Copy link
Contributor

tesk9 commented Aug 23, 2023

You are very welcome to add puppeteer tests!

The existing tests are primarily for running axe and percy against every example, but it's easy to amend the code to include additional assertions for a particular component. (You would want to adjust the component catalog example to include an example of the card pattern, I think, in order to test this properly).

Run script/puppeteer-tests.sh Tooltip locally without script/develop.sh running to avoid running all the puppeteer tests.

Add Tooltip to:

const specialProcessing = {
    Message: messageProcessing,
    Modal: modalProcessing,
    Page: pageProcessing,
    AssignmentIcon: iconProcessing,
    UiIcon: iconProcessing,
    Logo: iconProcessing,
    Pennant: iconProcessing,
  };

in order to write custom tests against the Tooltip component. Please be sure that everything that is tested in defaultProcessing is also tested in your new tests.

@bcardiff
Copy link
Member

Can we create custom elm apps for this? Having a sample app that will count/show parent click on disclosure tooltip does not seem a good fit for the catalog. Where could that app be placed?

@tesk9
Copy link
Contributor

tesk9 commented Aug 23, 2023

Having a sample app that will count/show parent click on disclosure tooltip does not seem a good fit for the catalog.

I disagree! I think that if there are common patterns in which components are used, and we want to make sure that these patterns continue to work, the Component Catalog is a great place to do so.

If you don't think that the Tooltip example is where a clickable-card-with-tooltip-disclosure example fits, I think another alternative is to add a new page that is specifically for this pattern.

I made a PR showing how this could be done: #1487

@tesk9
Copy link
Contributor

tesk9 commented Aug 23, 2023

(I'll be OOO for the next few days. If you need a11ybat input, please talk to Charbel and Kristine 🙏)

@bcardiff
Copy link
Member

I went on the route of adding a clickable container in the existing example to keep things simpler. But I think it would be good addition the PR to test interactions between components.

Currently it will look like this, and the counter allow us to test things via puppeteer.

Screen Shot 2023-08-24 at 16 55 47

Something else I notices is that puppeteer is VERY outdated. 13.0.1 is 2yrs old and the current release is 21.x. Something to have in mind in the future.

Copy link
Member

@bcardiff bcardiff left a comment

Choose a reason for hiding this comment

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

@caseyWebb do you agree with the latest push?

@caseyWebb
Copy link
Member Author

I think this is good for now.

Regarding puppeteer being so out of date, I wonder what the upgrade path there is and if we're using puppeteer anywhere else–if this is the only place it's used (and there is significant upgrade effort) I wonder if any effort should be put into migrating them to cypress instead of upgrading puppeteer. Not relevant for this pr, but a thought.

@krinhorn
Copy link
Contributor

(Looping in Charbel on the Puppeteer update thing separately - thanks much for raising!)

@bcardiff
Copy link
Member

I don't mind if we use puppeteer/cypress/playwright. I am not that experienced in either 😅 . My problem with the current state is that some documentation I found online was not working with 13.x since it's so outdated.

Let's merge this as is and discuss/prioritize a migration path.

@bcardiff bcardiff merged commit a3527cf into master Aug 24, 2023
6 checks passed
@bcardiff bcardiff deleted the tooltip-prevent-default branch August 24, 2023 20:54
@krinhorn
Copy link
Contributor

#1490 - Feel free to edit/comment/work on that issue

@linear
Copy link

linear bot commented Aug 28, 2023

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.

4 participants