Skip to content

Commit

Permalink
fix: attach and detach methods
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Jun 26, 2021
1 parent 257226a commit c9b5878
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ export class Context {
this.setDismiss(options.dismiss);
}

if (!element.hasAttribute('aria-label') &&
!element.hasAttribute('aria-labelledby') &&
!element.hasAttribute('aria-describedby')) {
// eslint-disable-next-line
console.warn('created a Context without aria-label', this);
}

/**
* @private
*/
Expand Down Expand Up @@ -307,8 +300,15 @@ export class Context {
if (this.active) {
return;
}
const element = this.element;
this._active = true;
await dispatchAsyncEvent(this.element, 'focusenter', this);
if (!element.hasAttribute('aria-label') &&
!element.hasAttribute('aria-labelledby') &&
!element.hasAttribute('aria-describedby')) {
// eslint-disable-next-line
console.warn('created a Context without aria-label', this);
}
await dispatchAsyncEvent(element, 'focusenter', this);
this.restore();
}

Expand Down Expand Up @@ -391,14 +391,13 @@ export class Context {
this.detach();
}
this.parent = parent;
this.enable();
}

/**
* Detach the context from the current Loock instance.
*/
detach() {
this.disable();
this.forceExit();
this.parent.removeContext(this);
this.parent = null;
}
Expand Down

0 comments on commit c9b5878

Please sign in to comment.