8000 fix(card): update clickable to use button and anchor by mcoker · Pull Request #6949 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

fix(card): update clickable to use button and anchor#6949

Merged
thatblindgeye merged 7 commits intopatternfly:v6from
mcoker:issue-6948
Aug 14, 2024
Merged

fix(card): update clickable to use button and anchor#6949
thatblindgeye merged 7 commits intopatternfly:v6from
mcoker:issue-6948

Conversation

@mcoker
Copy link
Contributor
@mcoker mcoker commented Aug 6, 2024

fixes #6948

Ran visual regressions and only the new/renamed examples failed (lack of a reference image to compare against)

Changes:

  • Updates the selectors in the existing selectable/clickable blocks to group the radio/check stuff in :is() so they're in a single selector instead of multiple (should be no visual change from that)
  • Adds the new button/link element class (.#{$card}__clickable-action) in the :is() groups where it's needed, just a couple of them

To test this in a local react dev environment:

  • Check this branch out in a clone of the core repo somewhere
  • Run yarn build-patternfly
    • This builds the dist package that we put on npm for @patternfly/patternfly at ./dist in the core repo
  • Rename the existing @patternfly/patternfly dir in the react repo where your dev server is running
    • assuming you're at the root of the patternfly-react repo, run mv node_modules/\@patternfly/patternfly node_modules/\@patternfly/patternfly.bak
  • Create a symlink of the core/dist dir to node_modules/@patternfly/patternfly in your react repo
    • Assuming you're still at the root of the patternfly-react repo, and the core repo is a sibling of the patternfly-react repo, run ln -s ../patternfly/dist node_modules/\@patternfly/patternfly. You can also specify the full paths to those dirs if that's more clear, like ln -s /path/to/the/core-repo/dist /path/to/the/patternfly-react-repo/node_modules/\@patternfly/patternfly

You may need to restart the react dev server for these changes to take effect? If you want to make modifications to the core CSS, you can just edit files in the core repo (currently checked out to this PR's branch), and when you're done, just run yarn build-patternfly, which will publish the changes to the ./dist dir. When that's done, the react dev server should auto-reload with the core changes.

@mcoker mcoker requested a review from thatblindgeye August 6, 2024 03:52
@patternfly-build
Copy link
Collaborator
patternfly-build commented Aug 6, 2024

Copy link
Contributor
@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Will try linking the content of this PR to React locally shortly, just wanted to leave a couple quick comments. In addition to the file comment below, it looks like the focus styling is a bit odd.

When focusing the actionable (button) card, the corners have that faint "being overlapped" effect we've seen elsewhere. In light theme:

image

Looks worse in dark theme:

image

The actionable (link) cards don't seem to have any focus styling, though. Lastly looks like the "Actionable secondary style" example would need the update to use buttons or anchors.

Comment on lines +2 to +4
<a class="{{pfv}}card__clickable-action{{#if card--actionable--IsDisabled}} pf-m-disabled{{/if}}" {{#if card--actionable--IsDisabled}}tabindex="-1"{{/if}} href="{{ternary card--actionable--href card--actionable--href '#'}}"></a>
{{else}}
<button {{#if card--actionable--IsDisabled}}disabled{{/if}} type="button" class="{{pfv}}card__clickable-action"></button>
Copy link
Contributor
@thatblindgeye thatblindgeye Aug 6, 2024

Choose a reason for hiding this comment

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

So (the?) one downside to having these placed wherever then absolutely positioned to fill the entire card for that "fully clickable card" functionality is consumers will probably need to pass appropriate aria labeling.

For our examples we could probably just use aria-labelledby and link to the title in each card since each of our examples has a title. In React we may need to add a couple new props then do a check if any of them are passed for an actionable card, and throw a warning if not.

@mcoker mcoker marked this pull request as ready for review August 7, 2024 19:48
@srambach
Copy link
Member
srambach commented Aug 9, 2024

Just a question - on https://patternfly-pr-6949.surge.sh/components/card/#actionable-button the current (clicked) card changes border color on hover, whereas the other selected variants do not. I'm not sure which is more correct; I think we did choose not to change the selected hover color but maybe it's better to.

@kmcfaul kmcfaul linked an issue Aug 12, 2024 that may be closed by this pull request
@mcoker
Copy link
Contributor Author
mcoker commented Aug 13, 2024

Nice catch @srambach! Updated 🐸👍

Copy link
Member
@srambach srambach left a comment

Choose a reason for hiding this comment

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

Hover looks good! 🎈

@thatblindgeye thatblindgeye merged commit d73a4e1 into patternfly:v6 Aug 14, 2024
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.210 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card - update clickable variations

4 participants

0