Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

@bsunderhus Quite a few visual changes, likely due to different margins on h2 vs div.

I wouldn't expect any visual changes. Do styles need to be updated to get the layout back to baseline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely @spmonahan, I'll investigate! thx for the feedback

"type": "patch",
"comment": "bugfix: DialogTitle root as h2 by default",
"packageName": "@fluentui/react-dialog",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export type DialogTitleProps = ComponentProps<DialogTitleSlots>;

// @public (undocumented)
export type DialogTitleSlots = {
root: Slot<'div', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>;
root: Slot<'h2', 'h1' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'>;
action?: Slot<'div'>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utili

export type DialogTitleSlots = {
/**
* By default this is a div, but can be a heading.
* By default this is a h2, but can be any heading or div,
* if `div` is provided do not forget to also provide proper `role="heading"` and `aria-level` attributes
*/
root: Slot<'div', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>;
root: Slot<'h2', 'h1' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'>;
/**
* By default a Dialog with modalType='non-modal' will have a close button action
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

exports[`DialogTitle renders a default state 1`] = `
<div>
<div
<h2
class="fui-DialogTitle"
>
Default DialogTitle
</div>
</h2>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<

return {
components: {
root: 'div',
root: 'h2',
action: 'div',
},
root: getNativeElementProps(as ?? 'div', {
root: getNativeElementProps(as ?? 'h2', {
ref,
id: useDialogContext_unstable(ctx => ctx.dialogTitleId),
...props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const useStyles = makeStyles({
root: {
...typographyStyles.subtitle1,
...shorthands.gridArea(TITLE_GRID_AREA),
...shorthands.margin(0),
},
rootWithoutCloseButton: {
...shorthands.gridArea(TITLE_GRID_AREA, TITLE_GRID_AREA, TITLE_ACTION_GRID_AREA, TITLE_ACTION_GRID_AREA),
Expand Down