@@ -9,13 +9,7 @@ export class PushbuttonElement extends LitElement {
9
9
10
10
static get styles ( ) {
11
11
return css `
12
- :host {
13
- display: inline-block;
14
- }
15
-
16
- .pushbutton-container {
17
- display: flex;
18
- flex-direction: column;
12
+ button {
19
13
border: none;
20
14
background: none;
21
15
padding: 0;
@@ -25,7 +19,7 @@ export class PushbuttonElement extends LitElement {
25
19
-moz-appearance: none;
26
20
}
27
21
28
- .pushbutton-container :active .button-circle {
22
+ button :active .button-circle {
29
23
fill: url(#grad-down);
30
24
}
31
25
@@ -38,7 +32,15 @@ export class PushbuttonElement extends LitElement {
38
32
render ( ) {
39
33
const { color } = this ;
40
34
return html `
41
- < button class ="pushbutton-container ">
35
+ < button
36
+ aria-label ="${ color } pushbutton "
37
+ @mousedown =${ this . down }
38
+ @mouseup =${ this . up }
39
+ @touchstart=${ this . down }
40
+ @touchend=${ this . up }
41
+ @keydown=${ ( e : KeyboardEvent ) => e . keyCode === SPACE_KEY && this . down ( ) }
42
+ @keyup=${ ( e : KeyboardEvent ) => e . keyCode === SPACE_KEY && this . up ( ) }
43
+ >
42
44
< svg
43
45
width ="18mm "
44
46
height ="12mm "
@@ -99,15 +101,6 @@ export class PushbuttonElement extends LitElement {
99
101
` ;
100
102
}
101
103
102
- firstUpdated ( ) {
103
- this . addEventListener ( 'mousedown' , this . down ) ;
104
- this . addEventListener ( 'touchstart' , this . down ) ;
105
- this . addEventListener ( 'mouseup' , this . up ) ;
106
- this . addEventListener ( 'touchend' , this . up ) ;
107
- this . addEventListener ( 'keydown' , ( e : KeyboardEvent ) => e . keyCode === SPACE_KEY && this . down ( ) ) ;
108
- this . addEventListener ( 'keyup' , ( e : KeyboardEvent ) => e . keyCode === SPACE_KEY && this . up ( ) ) ;
109
- }
110
-
111
104
private down ( ) {
112
105
if ( ! this . pressed ) {
113
106
this . pressed = true ;
0 commit comments