Skip to content

Commit 286ce2b

Browse files
authored
a11y: remove vertical margins on dialog to support 400% zoom (#34906)
1 parent 13e9d56 commit 286ce2b

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "a11y: remove vertical margins on dialog to support 400% zoom",
4+
"packageName": "@fluentui/web-components",
5+
"email": "rupertdavid@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/web-components/src/dialog-body/dialog-body.styles.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ export const styles = css`
4747
margin-block-start: calc(${spacingVerticalXXL} * -1);
4848
padding-block-end: ${spacingVerticalS};
4949
padding-block-start: ${spacingVerticalXXL};
50-
position: sticky;
51-
z-index: 1;
5250
}
5351
5452
.content {
@@ -71,8 +69,6 @@ export const styles = css`
7169
margin-block-end: calc(${spacingVerticalXXL} * -1);
7270
padding-block-end: ${spacingVerticalXXL};
7371
padding-block-start: ${spacingVerticalL};
74-
position: sticky;
75-
z-index: 2;
7672
}
7773
7874
::slotted([slot='title-action']) {
@@ -99,4 +95,15 @@ export const styles = css`
9995
padding-block-start: ${spacingVerticalS};
10096
}
10197
}
98+
99+
/* For a11y, set sticky position for title and actions when the viewport is tall enough */
100+
@media (min-height: 480px) {
101+
.title {
102+
position: sticky;
103+
z-index: 1;
104+
}
105+
.actions {
106+
position: sticky;
107+
z-index: 2;
108+
}
102109
`;

packages/web-components/src/dialog/dialog.styles.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const styles = css`
3434
border: none;
3535
box-shadow: ${shadow64};
3636
color: ${colorNeutralForeground1};
37-
max-height: calc(-48px + 100vh);
37+
max-height: 100vh;
3838
padding: 0;
3939
width: 100%;
4040
max-width: 600px;
@@ -46,6 +46,12 @@ export const styles = css`
4646
z-index: 2;
4747
overflow: auto;
4848
}
49+
50+
@supports (max-height: 1dvh) {
51+
dialog {
52+
max-height: 100dvh;
53+
}
54+
}
4955
}
5056
5157
@layer animations {

0 commit comments

Comments
 (0)