Skip to content

[Breaking Change][Fix]: remove default slotted title actions from dialog body #34469

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

eljefe223
Copy link
Contributor

Previous Behavior

The dialog-body template had a button defaulted in the title-actions slot. This was preventing the ability to set an accesible label on the button itself.

New Behavior

This PR does severalk things to fix the issue.

  1. Remove sthe default slotted button (This now needs to be passed in by the implementation)
  2. Adds a new close slot and keeps the title-actions slot for sub actions in the title
  3. Adds a click handler that listens for clicks on the element slotted into the close slot.

Related Issue(s)

  • Fixes #

@eljefe223 eljefe223 requested a review from a team as a code owner May 16, 2025 18:19
Copy link

github-actions bot commented May 16, 2025

📊 Bundle size report

✅ No changes found

Copy link

Pull request demo site: URL

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

@github-actions github-actions bot May 16, 2025

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 1 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/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.normal.chromium_1.png 39082 Changed
vr-tests-web-components/Switch 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Switch. - Dark Mode.normal.chromium_1.png 92 Changed

There were 1 duplicate changes discarded. Check the build logs for more information.

Copy link
Contributor

@radium-v radium-v left a comment

Choose a reason for hiding this comment

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

The Custom Close story for <fluent-dialog> still causes the default close action to happen after the alert happens in Storybook. Should the clickHandler() function check to see if event.defaultPrevented is false before running? That would allow for custom close action listeners to call event.preventDefault() to override the actual dialog-closing action.

@davatron5000
Copy link
Contributor

So we can openly document it for posterity's sake, can you post about what options you evaluated, what the relative pros and cons were and why we went with this design.

@eljefe223 eljefe223 force-pushed the users/jes/dialog-close-button-aria branch from 3b716b8 to faf7217 Compare May 16, 2025 21:07
*/
@attr({ mode: 'boolean', attribute: 'no-title-action' })
public noTitleAction: boolean = false;
public clickHandler(event: MouseEvent): boolean | void {
Copy link
Member

Choose a reason for hiding this comment

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

Should this method name be made more descriptive? clickHandler sounds a bit too generic for what it actually does.

* @returns true if the element is a dialog.
* @public
*/
export function isDialog(element?: Node | null, tagName: string = '-dialog'): element is Dialog {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any case where the dialog tag name doesn't end with -dialog? I'm just wondering if the tagName parameter is necessary.

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.

4 participants