Skip to content

Commit 2515291

Browse files
committed
chore(dropzone): extracted shared visually hidden class
1 parent 6d9f873 commit 2515291

3 files changed

Lines changed: 28 additions & 15 deletions

File tree

2nd-gen/packages/swc/components/dropzone/Dropzone.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { CSSResultArray, html, PropertyValues, TemplateResult } from 'lit';
1414

1515
import { DropzoneBase } from '@spectrum-web-components/core/components/dropzone';
1616

17+
import visuallyHiddenStyles from '../../stylesheets/_lit-styles/visually-hidden.css';
1718
import styles from './dropzone.css';
1819

1920
/**
@@ -49,7 +50,7 @@ import styles from './dropzone.css';
4950
*/
5051
export class Dropzone extends DropzoneBase {
5152
public static override get styles(): CSSResultArray {
52-
return [styles];
53+
return [visuallyHiddenStyles, styles];
5354
}
5455

5556
// ──────────────────────────
@@ -162,7 +163,11 @@ export class Dropzone extends DropzoneBase {
162163
protected override render(): TemplateResult {
163164
return html`
164165
<div class="swc-Dropzone">
165-
<div role="status" aria-live="polite" class="swc-Dropzone-status"></div>
166+
<div
167+
role="status"
168+
aria-live="polite"
169+
class="swc-Dropzone-status swc-VisuallyHidden"
170+
></div>
166171
${this.filled
167172
? html`
168173
<slot name="filled-content"></slot>

2nd-gen/packages/swc/components/dropzone/dropzone.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,6 @@
6969
text-align: center;
7070
}
7171

72-
/* ─────────────────────────────────────
73-
Visually-hidden status region
74-
───────────────────────────────────── */
75-
76-
.swc-Dropzone-status {
77-
position: absolute;
78-
inline-size: 1px;
79-
block-size: 1px;
80-
white-space: nowrap;
81-
overflow: hidden;
82-
clip-path: inset(50%);
83-
}
84-
8572
/* ─────────────────────────────────────
8673
Forced colors
8774
───────────────────────────────────── */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright 2026 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
/* Hides an element visually while keeping it accessible to assistive technology. */
14+
.swc-VisuallyHidden {
15+
position: absolute;
16+
inline-size: 1px;
17+
block-size: 1px;
18+
white-space: nowrap;
19+
overflow: hidden;
20+
clip-path: inset(50%);
21+
}

0 commit comments

Comments
 (0)