-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add Disabled State Handling #141
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR implements a disabled state for the auro-accordion component by adding a new Class diagram for AuroAccordion with Disabled StateclassDiagram
class AuroAccordion {
Boolean expanded
Boolean emphasis
Boolean grouped
Boolean disabled
String chevron
String variant
slot default
toggle(Event event)
}
note for AuroAccordion "Added 'disabled' property and updated 'toggle' method to handle disabled state."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Surge demo deployment failed! 😭 |
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.
Hey @fajar-apri-alaska - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding unit tests to verify the disabled state behavior, particularly around event handling and accessibility attribute management.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/style.scss
Outdated
:host([disabled]) { | ||
.trigger { | ||
pointer-events: none; | ||
opacity: 0.5; |
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.
We don't want to use opacity like this here. Instead we should be setting the text and chevron color to use the disabled token variant.
--ds-color-text-ui-disabled-default
--ds-color-icon-ui-disabled-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.
updated to use a token reference.
c1360ff
to
62ab6c6
Compare
@@ -33,6 +33,7 @@ import tokensCss from "./tokens-css.js"; | |||
* @attr {Boolean} expanded - If set, the accordion is expanded. | |||
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions. | |||
* @attr {Boolean} grouped - Attribute will be set on accordion when it appears in an accordion group. | |||
* @attr {Boolean} disabled - If set, the accordion is disabled and have reduced opacity. |
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.
This attribute isn't getting listed in the API.md doc and needs to be.
disabled: { | ||
type: Boolean, | ||
reflect: true |
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.
You should also be able to disable an entire accordion group without having to do the accordions individually.
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.
sure, I will provide the feature and the documentation for accordion-group also.
src/style.scss
Outdated
[auro-icon] { | ||
color: var(--ds-color-icon-ui-primary-disabled-default, $ds-color-icon-ui-primary-disabled-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.
the EOF extra line is missing.
docs/partials/api.md
Outdated
@@ -163,6 +163,22 @@ Use the `emphasis` attribute to apply border highlights to the `auro-accordion` | |||
|
|||
</auro-accordion> | |||
|
|||
### disabled |
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.
This is in the wrong spot in the doc. Currently it's under the examples for the accordion group and should be moved up in alphabetical order with the regular accordion examples.
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.
Sure, I will put the example above expanded
then.
demo/index.min.js
Outdated
@@ -742,6 +752,7 @@ class AuroAccordion extends r { | |||
id="accordionTrigger" | |||
aria-controls="accordionContent" | |||
aria-expanded="${this.expanded}" | |||
aria-disabled="${this.disabled ? 'true' : 'false'}" |
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.
aria-disabled="${this.disabled ? 'true' : 'false'}" | |
?aria-disabled="${this.disabled}" |
You can just conditionally add the attribute based on this.disabled
.
It's out of scope of this bug fix but aria-expanded
should also actually be done the same way. Feel free to make that change too if you don't mind.
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.
sure, I will add this with additional commit message then.
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.
oh wait, but if we do this, then the aria-* attributes will just basically not available when the value is false.
Is that fine for the screen reader?
Also, we need to update every unit test that checks the attributes, from:
hasAttribute('aria-expanded')).to.equal('false');
-> hasAttribute('aria-expanded')).to.null;
and
hasAttribute('aria-expanded')).to.equal('true');
-> hasAttribute('aria-expanded')).to.not.null;
src/style.scss
Outdated
[auro-icon] { | ||
color: var(--ds-color-icon-ui-primary-disabled-default, $ds-color-icon-ui-primary-disabled-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.
auro-icon already supports a disabled
state. We should use that instead of custom coloring within the accordion.
<auro-icon category="interface" name="pin-trip" disabled></auro-icon>
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.
Oh, I didn't know about this one, I will remember this information also for future work. Thanks.
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.
Hi @jason-capsule42,
After trying to implement this changes, I have concern about this:
The color token that was used for the trigger icon is --ds-auro-accordion-trigger-icon-color)
instead of --ds-auro-icon-color
Is this intended? I mean, then we couldn't apply the <auro-icon disabled>
, right?
- Add new `disabled` property for auro-accordion - Add new `disabled` property for auro-accordion-group to handle the disabled state of its whole accordion children - Add css styling for the disabled accordion - Add aria-disabled attribute as conditional attribute - Add example and update the documentation for the new feature - Update the 'aria-expanded' attribute to be as conditional attribute - Add test for the new feature and 'aria-expanded'-related test
62ab6c6
to
12008ab
Compare
I have addressed the feedbacks, please re-review @jason-capsule42. Thank you. |
Alaska Airlines Pull Request
This pull request enhances the auro-accordion component by adding support for a disabled state.
Fixes: #123
Summary:
The following changes have been made:
disabled
Property:disabled
property for auro-accordiondisabled
property for auro-accordion-group to handle the disabled state of its whole accordion childrenRender Method:
Updated the render method to conditionally add the aria-disabled attribute based on the disabled property.
Event Handling:
Modified the toggle method to prevent toggling the accordion content when the component is disabled.
CSS Styles:
Added styles to visually indicate the accordion disabled state by reducing opacity and disabling pointer events.
ARIA Attributes:
Documentation:
Added example and updated the documentation for the new feature for both accordion and accordion-group
Testing:
Added test for the new feature and update 'aria-expanded'-related test
Type of change:
Please delete options that are not relevant.
Checklist:
By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.
Thank you for your submission!
-- Auro Design System Team
Summary by Sourcery
Enhance the auro-accordion component by adding support for a disabled state, including a new 'disabled' property, CSS styling, and documentation updates.
New Features:
Enhancements:
Documentation: