Skip to content

Commit 191dc49

Browse files
alan-agius4clydin
authored andcommitted
fix(@schematics/angular): replace interactive div with button in application component template
A keyboard user who has a problem in using a mouse, will not be able to select the `div`, because he cannot initiate the click event, which is specific to the mouse. Interactive elements like button can initiate the click event on keyboard events. Instead of adding additional events, such as `keyup`, `keydown` or `keypress`, we replace these with a `button`. (cherry picked from commit 1b5e18e)
1 parent 09ec1f4 commit 191dc49

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

packages/schematics/angular/application/other-files/app.component.html.template

+16-31
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
}
9797

9898
.card {
99+
all: unset;
99100
border-radius: 4px;
100101
border: 1px solid #eee;
101102
background-color: #fafafa;
@@ -249,7 +250,6 @@
249250
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
250251
margin-left: 4px;
251252
font-weight: 600;
252-
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
253253
}
254254

255255
.github-star-badge:hover {
@@ -272,10 +272,8 @@
272272
width: 1920px;
273273
}
274274

275-
276275
/* Responsive Styles */
277276
@media screen and (max-width: 767px) {
278-
279277
.card-container > *:not(.circle-link) ,
280278
.terminal {
281279
width: 100%;
@@ -359,31 +357,24 @@
359357
<div class="card-container">
360358
<a class="card" target="_blank" rel="noopener" href="https://angular.io/tutorial">
361359
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"/></svg>
362-
363360
<span>Learn Angular</span>
364-
365361
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg> </a>
366362

367363
<a class="card" target="_blank" rel="noopener" href="https://angular.io/cli">
368364
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>
369-
370365
<span>CLI Documentation</span>
371-
372366
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
373367
</a>
374368

375369
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.io/">
376370
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
377-
378371
<span>Angular Blog</span>
379-
380372
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
381373
</a>
382374

383375
<a class="card" target="_blank" rel="noopener" href="https://angular.io/devtools/">
384376
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M14.73,13.31C15.52,12.24,16,10.93,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.43,0,2.74-0.48,3.81-1.27L19.59,21L21,19.59L14.73,13.31z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5 S11.99,14,9.5,14z"/><polygon points="10.29,8.44 9.5,6 8.71,8.44 6.25,8.44 8.26,10.03 7.49,12.5 9.5,10.97 11.51,12.5 10.74,10.03 12.75,8.44"/></g></g></svg>
385377
<span>Angular DevTools</span>
386-
387378
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
388379
</a>
389380

@@ -396,41 +387,35 @@
396387
<input type="hidden" #selection>
397388

398389
<div class="card-container">
399-
<div class="card card-small" (click)="selection.value = 'component'" tabindex="0">
400-
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
401-
390+
<button class="card card-small" (click)="selection.value = 'component'" tabindex="0">
391+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
402392
<span>New Component</span>
403-
</div>
404-
405-
<div class="card card-small" (click)="selection.value = 'material'" tabindex="0">
406-
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
393+
</button>
407394

395+
<button class="card card-small" (click)="selection.value = 'material'" tabindex="0">
396+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
408397
<span>Angular Material</span>
409-
</div>
410-
411-
<div class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
412-
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
398+
</button>
413399

400+
<button class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
401+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
414402
<span>Add PWA Support</span>
415-
</div>
403+
</button>
416404

417-
<div class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
405+
<button class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
418406
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
419-
420407
<span>Add Dependency</span>
421-
</div>
408+
</button>
422409

423-
<div class="card card-small" (click)="selection.value = 'test'" tabindex="0">
410+
<button class="card card-small" (click)="selection.value = 'test'" tabindex="0">
424411
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
425-
426412
<span>Run and Watch Tests</span>
427-
</div>
413+
</button>
428414

429-
<div class="card card-small" (click)="selection.value = 'build'" tabindex="0">
415+
<button class="card card-small" (click)="selection.value = 'build'" tabindex="0">
430416
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
431-
432417
<span>Build for Production</span>
433-
</div>
418+
</button>
434419
</div>
435420

436421
<!-- Terminal -->

0 commit comments

Comments
 (0)