Skip to content
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

refactor: use div with heading role instead of h2 in form title (#8441) (CP: 24.5) #8443

Merged
merged 1 commit into from
Jan 3, 2025
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
2 changes: 1 addition & 1 deletion packages/login/src/vaadin-lit-login-form-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LoginFormWrapper extends ThemableMixin(PolylitMixin(LitElement)) {
render() {
return html`
<section part="form">
<h2 part="form-title">${this.i18n.form.title}</h2>
<div part="form-title" role="heading" aria-level="2">${this.i18n.form.title}</div>
<div part="error-message" ?hidden="${!this.error}">
<strong part="error-message-title">${this.i18n.errorMessage.title}</strong>
<p part="error-message-description">${this.i18n.errorMessage.message}</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/login/src/vaadin-login-form-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LoginFormWrapper extends ThemableMixin(PolymerElement) {
static get template() {
return html`
<section part="form">
<h2 part="form-title">[[i18n.form.title]]</h2>
<div part="form-title" part="form-title" role="heading" aria-level="2">[[i18n.form.title]]</div>
<div part="error-message" hidden$="[[!error]]">
<strong part="error-message-title">[[i18n.errorMessage.title]]</strong>
<p part="error-message-description">[[i18n.errorMessage.message]]</p>
Expand Down
24 changes: 18 additions & 6 deletions packages/login/test/dom/__snapshots__/login-form.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,13 @@ snapshots["vaadin-login-form host noForgotPassword"] =

snapshots["vaadin-login-form shadow default"] =
`<section part="form">
<h2 part="form-title">
<div
aria-level="2"
part="form-title"
role="heading"
>
Log in
</h2>
</div>
<div
hidden=""
part="error-message"
Expand Down Expand Up @@ -597,9 +601,13 @@ snapshots["vaadin-login-form shadow default"] =

snapshots["vaadin-login-form shadow error"] =
`<section part="form">
<h2 part="form-title">
<div
aria-level="2"
part="form-title"
role="heading"
>
Log in
</h2>
</div>
<div part="error-message">
<strong part="error-message-title">
Incorrect username or password
Expand Down Expand Up @@ -628,9 +636,13 @@ snapshots["vaadin-login-form shadow error"] =

snapshots["vaadin-login-form shadow i18n"] =
`<section part="form">
<h2 part="form-title">
<div
aria-level="2"
part="form-title"
role="heading"
>
Kirjaudu sisään
</h2>
</div>
<div
hidden=""
part="error-message"
Expand Down
4 changes: 4 additions & 0 deletions packages/login/theme/lumo/vaadin-login-form-wrapper-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const loginFormWrapper = css`
[part='form-title'] {
margin-top: calc(var(--lumo-font-size-xxxl) - var(--lumo-font-size-xxl));
color: var(--lumo-header-text-color);
font-size: var(--lumo-font-size-xxl);
font-weight: 600;
line-height: var(--lumo-line-height-xs);
}
::slotted([slot='submit']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const loginFormWrapper = css`
[part='form-title'] {
margin-top: calc(var(--material-h3-font-size) - var(--material-h4-font-size));
font-size: var(--material-h5-font-size);
font-weight: 300;
line-height: 1.1;
letter-spacing: -0.01em;
text-indent: -0.07em;
}
::slotted([slot='submit']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const loginFormWrapper = css`
padding: 2rem 2.5rem 2rem 1.8rem;
}

:host([theme~='with-overlay']) [part='form'] h2 {
:host([theme~='with-overlay']) [part='form-title'] {
text-align: center;
font-size: 1.8em;
font-weight: 500;
Expand Down