-
Notifications
You must be signed in to change notification settings - Fork 23
Investigate code duplication between cc-dialog and cc-drawer #1650
Copy link
Copy link
Open
Labels
maintenanceCode refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)Code refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)
Description
Context
cc-dialog and cc-drawer share significant implementation details since both are built on top of the native <dialog> element with modal behavior.
Shared code
- Properties:
heading,open - Internal state:
_dialogRef,_openerElement - Public methods:
show(),hide() - Private methods:
_autofocusOnOpen(),_tryToFocusOpenerElement(),_onDialogClose() - Lifecycle logic: Opening/closing behavior in
updated(), focus restoration indisconnectedCallback() - Events:
CcOpenEvent,CcCloseEvent,CcFocusRestorationFailEvent - Styles:
::backdropstyling,accessibilityStyles
Why this matters
- Code duplication increases maintenance burden
- Risk of inconsistent behavior if one component is updated but not the other
- Shared accessibility and focus management logic should behave identically
Next steps
Evaluate whether and how to reduce this duplication (mixin, base class, controller, or leave as-is if the cost outweighs the benefits).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
maintenanceCode refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)Code refactoring, project structure, dev tooling (storybook, dev server, npm tasks...)