-
Notifications
You must be signed in to change notification settings - Fork 156
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
fix: Fix visual bugs in drawer toggle buttons #1343
Conversation
ac28d2a
to
1f423ae
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1343 +/- ##
=======================================
Coverage 93.46% 93.46%
=======================================
Files 623 623
Lines 16731 16733 +2
Branches 5527 5527
=======================================
+ Hits 15637 15639 +2
Misses 1021 1021
Partials 73 73
☔ View full report in Codecov by Sentry. |
1f423ae
to
63d23db
Compare
63d23db
to
2f4b458
Compare
2f4b458
to
503f7f5
Compare
21ff56e
to
e526398
Compare
e526398
to
fd2044e
Compare
@@ -91,13 +91,14 @@ function setupTest( | |||
'drawers focus toggles between open and close buttons', | |||
setupTest( | |||
async page => { | |||
await page.click(wrapper.findDrawersTriggers().get(2).toSelector()); | |||
const triggerSelector = wrapper.findDrawerTriggerById('pro-help').toSelector(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:nth-child
does not work anymore, because every button has a wrapper now.
Since this feature is not in production yet, we can do such breaking changes
$_toggle-padding-horizontal: 0.7 * styles.$base-size; | ||
$_toggle-padding-vertical: awsui.$space-xxs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefix a variable with underscore makes it available only inside the current file
&.drawer-content-clickable { | ||
cursor: pointer; | ||
color: awsui.$color-text-interactive-default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some refactoring in this file to more clearly connect styles and their reasons.
Why is there a pointer cursor? Not because the drawer is closed, but because it is clickable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be closed non-clickable drawers and the new CSS structure allows that
@@ -63,34 +62,26 @@ $drawer-z-index-mobile: 1001; | |||
} | |||
} | |||
|
|||
.trigger { | |||
.drawer-content > .drawer-triggers > & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this PR, app layout used our button component and this line overrode button styles.
Overriding styles is bad even if done for a good reason, it still may cause issues.
In this PR I replaced it with custom styles on top of native <button>
tag (see the <ToggleButton>
component) which has the correct styles from the start, without overrides
@@ -12,7 +12,6 @@ | |||
} | |||
|
|||
.mobile-bar { | |||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore with our current browser support
@@ -8,6 +9,7 @@ export interface AppLayoutButtonProps { | |||
ariaExpanded?: boolean; | |||
iconName?: IconProps.Name; | |||
iconSvg?: React.ReactNode; | |||
onClick: () => void; | |||
onClick?: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it optional, because in some cases, the wrapper element is clickable and button does not have an its own listener
@@ -331,7 +331,6 @@ export type ColorsTokenName = | |||
| 'colorForegroundControlDefault' | |||
| 'colorForegroundControlDisabled' | |||
| 'colorShadowDefault' | |||
| 'colorShadowLayoutToggle' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced this token with colorBorderLayout
rendering the same look
fd2044e
to
36bc0cc
Compare
Before this change the focus rings in Classic didn't look right, they were cut off: After this change they are shown inside the corresponding toggle button, which gets rid of this particular problem, but there are still a couple things that I think could be improved:
I see two possible ways to fix this:
|
I knew about this issue and I will fix it in the next iteration. The current state is not a regression comparing to before |
Description
Fix focus and hover style issues with drawer triggers.
Updated the non-drawer toggle buttons too, to have unified implementation
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.