Skip to content

Commit 4ababe0

Browse files
committed
chore(dropzone): address feedback
1 parent 79ce5e3 commit 4ababe0

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

2nd-gen/packages/core/components/dropzone/Dropzone.base.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,13 @@ export abstract class DropzoneBase extends SpectrumElement {
209209
// ──────────────────────────────
210210

211211
/**
212-
* Called when the `dragged` state changes. Subclasses override this to
212+
* Called when the `dragged` state changes. Subclasses implement this to
213213
* update the shadow DOM status region for accessibility announcements.
214214
*
215-
* @param _isDragged - `true` when drag enters; `false` when it leaves.
215+
* @param isDragged - `true` when drag enters; `false` when it leaves.
216216
* @internal
217217
*/
218-
protected _onDragStateChange(_isDragged: boolean): void {
219-
// Implemented in the concrete SWC class.
220-
}
218+
protected abstract _onDragStateChange(isDragged: boolean): void;
221219

222220
/** @internal */
223221
private _clearDragLeaveTimer(): void {

2nd-gen/packages/core/components/dropzone/Dropzone.types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,12 @@ export const SWC_DROPZONE_DRAGLEAVE_EVENT = 'swc-dropzone-dragleave';
3939

4040
/** Fired when files are dropped on the drop zone. */
4141
export const SWC_DROPZONE_DROP_EVENT = 'swc-dropzone-drop';
42+
43+
declare global {
44+
interface GlobalEventHandlersEventMap {
45+
[SWC_DROPZONE_SHOULD_ACCEPT_EVENT]: CustomEvent<DragEvent>;
46+
[SWC_DROPZONE_DRAGOVER_EVENT]: CustomEvent<DragEvent>;
47+
[SWC_DROPZONE_DRAGLEAVE_EVENT]: CustomEvent<DragEvent>;
48+
[SWC_DROPZONE_DROP_EVENT]: CustomEvent<DragEvent>;
49+
}
50+
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export class Dropzone extends DropzoneBase {
6060

6161
public override connectedCallback(): void {
6262
super.connectedCallback();
63-
if (!this.hasAttribute('role')) {
64-
this.setAttribute('role', 'group');
65-
}
63+
this.setAttribute('role', 'group');
6664
if (window.__swc?.DEBUG) {
6765
this._warnMissingAccessibleName();
6866
}

0 commit comments

Comments
 (0)