Skip to content

Commit

Permalink
fix: final prerelease review of canary builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Jan 13, 2021
1 parent a396c86 commit 1fc032f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions packages/button/src/ButtonBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ export class ButtonBase extends LikeAnchor(
}
}

private handleFocusout(): void {
private handleRemoveActive(): void {
this.active = false;
}

private handlePointerdown(): void {
this.active = true;
}

private manageRole(): void {
if (this.href && this.href.length > 0) {
this.removeAttribute('role');
Expand All @@ -198,6 +202,7 @@ export class ButtonBase extends LikeAnchor(
this.addEventListener('click', this.shouldProxyClick);
this.addEventListener('keydown', this.handleKeydown);
this.addEventListener('keypress', this.handleKeypress);
this.addEventListener('pointerdown', this.handlePointerdown);
}

protected updated(changed: PropertyValues): void {
Expand All @@ -210,9 +215,11 @@ export class ButtonBase extends LikeAnchor(
}
if (changed.has('active')) {
if (this.active) {
this.addEventListener('focusout', this.handleFocusout);
this.addEventListener('focusout', this.handleRemoveActive);
this.addEventListener('pointerup', this.handleRemoveActive);
} else {
this.removeEventListener('focusout', this.handleFocusout);
this.removeEventListener('focusout', this.handleRemoveActive);
this.removeEventListener('pointerup', this.handleRemoveActive);
}
}
if (this.anchorElement) {
Expand Down
4 changes: 3 additions & 1 deletion packages/styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
},
"files": [
"custom-elements.json",
"*.css"
"*.css",
"*.js",
"*.ts"
],
"sideEffects": [
"./*.css"
Expand Down

0 comments on commit 1fc032f

Please sign in to comment.