-
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
Handle nested clickable trigger elements #154
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request addresses an issue where nested clickable elements within an accordion trigger were not handled correctly. The fix ensures that clicks on these nested elements do not interfere with the accordion's toggle behavior. Additionally, the auro-accordion-button component was refactored to extend LitElement instead of AuroButton. Sequence diagram for nested button click handlingsequenceDiagram
actor User
participant NB as Nested Button
participant AB as Accordion Button
participant AC as Accordion Component
User->>NB: clicks nested button
NB->>NB: stopImmediatePropagation()
NB->>NB: stopPropagation()
NB-->>User: handle button click
Note over NB,AB: Event propagation stopped
Note right of AB: Accordion remains unchanged
User->>AB: clicks accordion button
AB->>AC: toggle()
AC->>AC: update expanded state
AC-->>User: show/hide content
Class diagram showing accordion button component changesclassDiagram
class LitElement
class AuroAccordionButton {
+static styles
+static properties
+static register(name)
+render()
}
note for AuroAccordionButton "Changed parent class from AuroButton to LitElement"
LitElement <|-- AuroAccordionButton
class AuroAccordion {
-expanded: boolean
-accordionButton: Element
+firstUpdated()
+toggle()
+render()
}
note for AuroAccordion "Added event listener in firstUpdated"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Surge demo deployment failed! 😭 |
apiExamples/nestedButton.html
Outdated
<auro-accordion id="nestedButtonExample"> | ||
<span slot="trigger"> | ||
Click the button for a test | ||
<button id="nestedButton">Alaska Airlines</button> |
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.
Our example needs to be an auro-button rather than an HTML5 button.
button.addEventListener('click', (event) => { | ||
event.stopImmediatePropagation(); | ||
event.stopPropagation(); | ||
console.log('Button clicked'); |
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.
console.log('Button clicked'); | |
console.log('The button in the accordion trigger was clicked. Accordion should not have expanded or collapsed.'); |
src/auro-accordion.js
Outdated
@@ -142,6 +148,7 @@ export class AuroAccordion extends LitElement { | |||
* Toggles the visibility of the accordion content. | |||
*/ | |||
toggle() { | |||
console.log('button clicked, toggling.......') |
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.
I think we can ditch this console log since it's obvious on the screen that the UI changes.
// &:after { | ||
// border-color: transparent; // not supported by tokens - this should never have a color regardless of the theme | ||
// } | ||
} | ||
|
||
// .auro-button { | ||
// all: unset; | ||
// width: 100%; | ||
// padding: var(--ds-size-200, $ds-size-200) 0; | ||
|
||
// cursor: pointer; | ||
|
||
// pointer-events: none; | ||
|
||
// &:after { | ||
// border-color: transparent; // not supported by tokens - this should never have a color regardless of the theme | ||
// } | ||
// } | ||
|
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.
Get rid of the commented out code.
@@ -13,20 +13,36 @@ | |||
:host { | |||
border: unset; | |||
|
|||
.auro-button { | |||
button { | |||
font: inherit; |
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.
Do we actually need this font
rule?
84b7fc1
to
9e2e342
Compare
bd41328
to
ffaf7b4
Compare
Alaska Airlines Pull Request
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Resolves: #153
Summary:
Please summarize the scope of the changes you have submitted, what the intent of the work is and anything that describes the before/after state of the project.
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
New Features: