Skip to content

fix: make setItems method on accordion protected for extensibility of base class#35898

Closed
chrisdholt wants to merge 1 commit intomicrosoft:masterfrom
chrisdholt:users/chhol/make-accordion-set-items-protected
Closed

fix: make setItems method on accordion protected for extensibility of base class#35898
chrisdholt wants to merge 1 commit intomicrosoft:masterfrom
chrisdholt:users/chhol/make-accordion-set-items-protected

Conversation

@chrisdholt
Copy link
Copy Markdown
Member

Previous Behavior

Private methods prevent extensibility of the base class.

New Behavior

setItems method updated to support extensibility by changing from private to protected

Related Issue(s)

  • Fixes #

@chrisdholt chrisdholt requested a review from a team as a code owner March 24, 2026 21:31
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

📊 Bundle size report

✅ No changes found

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link
Copy Markdown

@github-actions github-actions bot Mar 24, 2026

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-web-components/Avatar 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Avatar. - Dark Mode.normal.chromium_1.png 298 Changed
vr-tests-web-components/Avatar. - Dark Mode.normal.chromium.png 10380 Changed
vr-tests-web-components/MenuList 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/MenuList. - RTL.2nd selected.chromium.png 17 Changed
vr-tests-web-components/MenuList. - RTL.2nd selected.chromium_3.png 38816 Changed

* @returns {void}
*/
private setItems = (): void => {
protected setItems = (): void => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally all of the methods that belong to the Accordion would be class methods instead of instance properties:

Suggested change
protected setItems = (): void => {
protected setItems(): void {

(You'll also have to remove the semicolon on line 131)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected isSingleExpandMode(): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected setSingleExpandMode(expandedItem: Element): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected removeItemListeners(oldValue: any): void {

The type for oldValue should probably also be something better than any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public expandedChangedHandler: EventListener = (evt: Event): void => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is actually one of the specific things that should be addressed beyond marking the methods protected/public: why are the event handlers being added and removed to the child accordion items, by the accordion itself? It should either use one event on the accordion that identifies which accordion item was clicked, or the accordion items themselves should handle their own click events.

@chrisdholt chrisdholt force-pushed the users/chhol/make-accordion-set-items-protected branch from 94c2f7b to 1cf30b5 Compare March 27, 2026 18:40
@chrisdholt
Copy link
Copy Markdown
Member Author

Closing in favor of a robust follow-up from @radium-v

@chrisdholt chrisdholt closed this Mar 27, 2026
@chrisdholt chrisdholt deleted the users/chhol/make-accordion-set-items-protected branch March 27, 2026 18:55
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.

3 participants