@@ -9,13 +9,7 @@ export class PushbuttonElement extends LitElement {
99
1010 static get styles ( ) {
1111 return css `
12- :host {
13- display: inline-block;
14- }
15-
16- .pushbutton-container {
17- display: flex;
18- flex-direction: column;
12+ button {
1913 border: none;
2014 background: none;
2115 padding: 0;
@@ -25,7 +19,7 @@ export class PushbuttonElement extends LitElement {
2519 -moz-appearance: none;
2620 }
2721
28- .pushbutton-container :active .button-circle {
22+ button :active .button-circle {
2923 fill: url(#grad-down);
3024 }
3125
@@ -38,7 +32,15 @@ export class PushbuttonElement extends LitElement {
3832 render ( ) {
3933 const { color } = this ;
4034 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+ >
4244 < svg
4345 width ="18mm "
4446 height ="12mm "
@@ -99,15 +101,6 @@ export class PushbuttonElement extends LitElement {
99101 ` ;
100102 }
101103
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-
111104 private down ( ) {
112105 if ( ! this . pressed ) {
113106 this . pressed = true ;
0 commit comments