Skip to content

chore(Alert): updated toggle and close styling per audit#7086

Merged
mcoker merged 4 commits intopatternfly:mainfrom
thatblindgeye:alertAuditUpdates
Sep 24, 2024
Merged

chore(Alert): updated toggle and close styling per audit#7086
mcoker merged 4 commits intopatternfly:mainfrom
thatblindgeye:alertAuditUpdates

Conversation

@thatblindgeye
Copy link
Contributor

Closes #7054

Toggle before update:
Alert expand toggle currently shifted too far to the right

Toggle after update:
Alert expand toggle shifted to the left

Close button before update:
Alert close button currently with smaller clickable area

Close button after update:
Alert close button with a larger clickable area

Do we ever intend for consumers to ever be able to have multiple actions in an Alert, not just a close button? Wondering if having the action button be larger would cause issues if that's the case.

@patternfly-build
Copy link
Collaborator

patternfly-build commented Sep 17, 2024

@mcoker
Copy link
Contributor

mcoker commented Sep 17, 2024

Do we ever intend for consumers to ever be able to have multiple actions in an Alert, not just a close button? Wondering if having the action button be larger would cause issues if that's the case.

I think the comment was just around the button not being the right height from the line-height you fixed, so I'd expect any add'l actions to be the same size as the close button is now.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd like to use the semantic spacer for the toggle margin if possible. Left another comment, but I can add that as a follow-up if you don't want to add anything additional to this PR.

@@ -226,10 +228,6 @@
margin-block-end: var(--#{$alert}__action--MarginBlockEnd);
margin-inline-end: var(--#{$alert}__action--MarginInlineEnd);
transform: translateY(var(--#{$alert}__action--TranslateY));
Copy link
Contributor

Choose a reason for hiding this comment

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

wdyt about removing this? It's causing the close button to be off-center. My guess is it had something to do with the button being smaller? From this PR, here's what it looks like with/without the transform

Before
Screenshot 2024-09-17 at 3 31 43 PM

After
Screenshot 2024-09-17 at 3 31 55 PM

And while I'm here, I don't know why we have display: flex and margin-block-start on .pf-v6-c-alert__icon. Taking both of those off aligns the icon as expected with the text because both the icon and text are inline with the same font-size and line-height.

That's scope creep though, so I can create a follow-up unless you want to give it a shot in this PR.

--#{$alert}__toggle--MarginBlockEnd: calc(-1 * var(--pf-t--global--spacer--control--vertical--default));
--#{$alert}__toggle--MarginInlineEnd: var(--pf-t--global--spacer--sm);
--#{$alert}__toggle--MarginInlineStart: calc(-1 * var(--pf-t--global--spacer--action--horizontal--plain--default));
--#{$alert}__toggle--MarginInlineEnd: var(--pf-t--global--spacer--action--horizontal--plain--default);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this one should just use a regular spacer - or do you think it should use the action spacer? If so can you add why?

Suggested change
--#{$alert}__toggle--MarginInlineEnd: var(--pf-t--global--spacer--action--horizontal--plain--default);
--#{$alert}__toggle--MarginInlineEnd: var(--pf-t--global--spacer--sm);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would we want this to also be the horizontal spacer for the same reason as using it for the MarginInlineStart var?

Actually wondering if it would make sense to reverse the tokens, so that the sm token is used in the calc for MarginInlineStart, and the horizontal-plain one is used for MarginInlineEnd. If the horizontal token were customized, would we want that to affect the InlineStart spacing? It could cause the toggle to look like it's "breaking out" of the alert container (below screenshot is using the horizontal plain token on InlineStart only with an override of 24px, using sm token on InlineEnd):

image

Versus switching the tokens:

image

Though maybe this is also a case for not using the horizontal token for either var.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed off GitHub. We're gonna go with reverting the MarginInlineEnd to the sm spacer, with the intent being that additional overrides may need to be taken (e.g. overriding the --#{$alert}--PaddingInlineStart var).

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Just one comment but otherwise LGTM! Here's the visual regression report from any example URL with "alert"

BackstopJS Report.pdf
BackstopJS Report.pdf
BackstopJS Report.pdf

@mcoker mcoker requested a review from srambach September 18, 2024 20:50
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LPTM! Thanks @thatblindgeye! 🥳

@andrew-ronaldson andrew-ronaldson self-requested a review September 23, 2024 21:43
Copy link
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

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

This if fan-freaking-tastic!

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.

🚨 Looks good to me.

@mcoker mcoker merged commit 23df6b3 into patternfly:main Sep 24, 2024
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.

Alert - audit improvements

5 participants