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

Support tooltip for Page primary & secondary actions #6709

Merged
merged 2 commits into from
Jul 28, 2022
Merged

Conversation

aminpaks
Copy link
Contributor

@aminpaks aminpaks commented Jul 21, 2022

WHY are these changes introduced?

Fixes https://github.com/Shopify/core-access/issues/409

These changes are being introduced because we want to be able to provide context for a user if there is a reason why we disable a Page Action. The above ticket shows an example of this where we want to show a Tooltip so we can tell the user why this button is disabled for them.

This change will allow us to provide this context to consumers of Polaris that utilize Page actions, it's optional and will not effect existing Page actions.

WHAT is this pull request doing?

Adds an option tooltip prop to Page actions.

How to 🎩

Top-hat instructions available in this PR which is using a snapshot of this Polaris change. https://github.com/Shopify/web/pull/69430

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}

🎩 checklist

Not tophatted on mobile since this change does not effect Page actions inside the mobile ... ActionList. Not tested for accessibility since it is not adding any new visual elements.

@ghost
Copy link

ghost commented Jul 21, 2022

👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines.

@aminpaks aminpaks changed the title Add tooltip to Page primary & secondary actions Support tooltip for Page primary & secondary actions Jul 21, 2022
@aminpaks
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Jul 22, 2022

size-limit report 📦

Path Size
polaris-react-cjs 198.39 KB (+0.05% 🔺)
polaris-react-esm 133.15 KB (-0.03% 🔽)
polaris-react-esnext 188.35 KB (+0.02% 🔺)
polaris-react-css 41.79 KB (+0.1% 🔺)

@aminpaks
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

🫰✨ Thanks @aminpaks! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

yarn add @shopify/polaris@0.0.0-snapshot-release-20220722103118

@aminpaks aminpaks force-pushed the actions-tooltip branch 3 times, most recently from adb2e3a to e58de56 Compare July 22, 2022 17:00
@aminpaks
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

🫰✨ Thanks @aminpaks! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

yarn add @shopify/polaris@0.0.0-snapshot-release-20220722172021

@peterlazzarino peterlazzarino marked this pull request as ready for review July 26, 2022 19:09
@sarahill
Copy link
Contributor

sarahill commented Jul 26, 2022

This looks good on larger screens. Works on hover and focus as expected.

Couple things on small screens:

  • Disabled option is interactive
  • Since I can't hover to get a tooltip here, we'll need to think about how that message shows up when it's in a dropdown. You could potentially show the message below Refund when it's in the list... would need to see how that would fit.

refund

@peterlazzarino peterlazzarino requested a review from a team July 27, 2022 12:28
@peterlazzarino
Copy link
Contributor

peterlazzarino commented Jul 27, 2022

Thanks for the feedback @sarahill , for those two items, we are planning on following up on a UX pattern for mobile but IIRC the team had concerns around tooltips on mobile (stacking actions) obscuring other items, so the tooltip would have to be custom styled. They wanted to get this shipped while they come up with a solution.

As for the interact-able button, I looked at what this is like now on the Page component and it seems this is currently how that button behaves for small screen disabled actions, so not a regression from this PR. I put up a code sandbox using Polaris 9.2.1 to confirm if you want to take a look. https://codesandbox.io/s/tmg9qm?module=App.js&file=/App.js . Even though in this case the button is properly disabled, there are some Polaris styles on hover and active that make it appear interact-able.

@chloerice chloerice force-pushed the actions-tooltip branch 6 times, most recently from e7f09e2 to 03d934e Compare July 27, 2022 18:24
@peterlazzarino
Copy link
Contributor

/snapit

@github-actions
Copy link
Contributor

🫰✨ Thanks @peterlazzarino! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

yarn add @shopify/polaris@0.0.0-snapshot-release-20220728132629

@peterlazzarino
Copy link
Contributor

Snapped and 🎩 on web, looking good!

@chloerice chloerice merged commit 47e8244 into main Jul 28, 2022
@chloerice chloerice deleted the actions-tooltip branch July 28, 2022 14:46
@ghost
Copy link

ghost commented Jul 28, 2022

🎉 Thanks for your contribution to Polaris!

@github-actions github-actions bot mentioned this pull request Jul 28, 2022
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.

None yet

4 participants