|
| 1 | +<div> |
| 2 | + <mat-card class="demo-mat-card"> |
| 3 | + <mat-toolbar color="primary">Basic</mat-toolbar> |
| 4 | + <mat-card-content class="demo-mat-card-content"> |
| 5 | + <button mat-raised-button (click)="toggleFocus(basicFocusTrap)"> |
| 6 | + {{basicFocusTrap && basicFocusTrap.enabled ? "Disable" : "Enable"}} FocusTrap |
| 7 | + </button> |
| 8 | + <div class="demo-focus-trap-region" #basicDemoRegion |
| 9 | + [class.demo-focus-trap-enabled]="(basicFocusTrap && basicFocusTrap.enabled) || false"> |
| 10 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 11 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 12 | + </div> |
| 13 | + </mat-card-content> |
| 14 | + </mat-card> |
| 15 | + |
| 16 | + <mat-card class="demo-mat-card"> |
| 17 | + <mat-toolbar color="primary">Nested</mat-toolbar> |
| 18 | + <mat-card-content class="demo-mat-card-content"> |
| 19 | + <button mat-raised-button (click)="toggleFocus(nestedOuterFocusTrap)"> |
| 20 | + {{nestedOuterFocusTrap && nestedOuterFocusTrap.enabled ? "Disable" : "Enable"}} outer FocusTrap |
| 21 | + </button> |
| 22 | + <div class="demo-focus-trap-region" #nestedOuterDemoRegion |
| 23 | + [class.demo-focus-trap-enabled]="(nestedOuterFocusTrap && nestedOuterFocusTrap.enabled) || false"> |
| 24 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 25 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 26 | + <button mat-raised-button class="demo-focus-trap-element" |
| 27 | + (click)="toggleFocus(nestedInnerFocusTrap)"> |
| 28 | + {{nestedInnerFocusTrap && nestedInnerFocusTrap.enabled ? "Disable" : "Enable"}} inner FocusTrap |
| 29 | + </button> |
| 30 | + <div class="demo-focus-trap-region" #nestedInnerDemoRegion |
| 31 | + [class.demo-focus-trap-enabled]="(nestedInnerFocusTrap && nestedInnerFocusTrap.enabled) || false"> |
| 32 | + <textarea class="demo-focus-trap-element" placeholder="Three"></textarea> |
| 33 | + <textarea class="demo-focus-trap-element" placeholder="Four"></textarea> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + </mat-card-content> |
| 37 | + </mat-card> |
| 38 | + |
| 39 | + <mat-card class="demo-mat-card"> |
| 40 | + <mat-toolbar color="primary">Tabindex > 0</mat-toolbar> |
| 41 | + <mat-card-content class="demo-mat-card-content"> |
| 42 | + <button mat-raised-button (click)="toggleFocus(tabIndexFocusTrap)"> |
| 43 | + {{tabIndexFocusTrap && tabIndexFocusTrap.enabled ? "Disable" : "Enable"}} FocusTrap |
| 44 | + </button> |
| 45 | + <div class="demo-focus-trap-region" #tabIndexDemoRegion |
| 46 | + [class.demo-focus-trap-enabled]="(tabIndexFocusTrap && tabIndexFocusTrap.enabled) || false"> |
| 47 | + <textarea class="demo-focus-trap-element" tabindex="1" |
| 48 | + placeholder="I have tabindex 1"></textarea> |
| 49 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 50 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 51 | + </div> |
| 52 | + <textarea class="demo-focus-trap-element" tabindex="1" |
| 53 | + placeholder="I have tabindex 1"></textarea> |
| 54 | + </mat-card-content> |
| 55 | + </mat-card> |
| 56 | + |
| 57 | + <mat-card class="demo-mat-card"> |
| 58 | + <mat-toolbar color="primary">Shadow DOMs</mat-toolbar> |
| 59 | + <mat-card-content class="demo-mat-card-content"> |
| 60 | + <button mat-raised-button (click)="toggleFocus(shadowDomFocusTrap)"> |
| 61 | + {{shadowDomFocusTrap && shadowDomFocusTrap.enabled ? "Disable" : "Enable"}} FocusTrap |
| 62 | + </button> |
| 63 | + <div class="demo-focus-trap-region" #shadowDomDemoRegion |
| 64 | + [class.demo-focus-trap-enabled]="(shadowDomFocusTrap && shadowDomFocusTrap.enabled) || false"> |
| 65 | + <shadow-dom-demo> |
| 66 | + <textarea placeholder="I am in a shadow DOM"></textarea> |
| 67 | + </shadow-dom-demo> |
| 68 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 69 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 70 | + </div> |
| 71 | + <shadow-dom-demo> |
| 72 | + <textarea class="demo-focus-trap-element" placeholder="I am in a shadow DOM"></textarea> |
| 73 | + </shadow-dom-demo> |
| 74 | + </mat-card-content> |
| 75 | + </mat-card> |
| 76 | + |
| 77 | + <mat-card class="demo-mat-card"> |
| 78 | + <mat-toolbar color="primary">iframes</mat-toolbar> |
| 79 | + <mat-card-content class="demo-mat-card-content"> |
| 80 | + <button mat-raised-button (click)="toggleFocus(iframeFocusTrap)"> |
| 81 | + {{iframeFocusTrap && iframeFocusTrap.enabled ? "Disable" : "Enable"}} FocusTrap |
| 82 | + </button> |
| 83 | + <div class="demo-focus-trap-region" #iframeDemoRegion |
| 84 | + [class.demo-focus-trap-enabled]="(iframeFocusTrap && iframeFocusTrap.enabled) || false"> |
| 85 | + <iframe class="demo-focus-trap-element" |
| 86 | + srcdoc="<textarea placeholder='I am in an iframe'></textarea>"> |
| 87 | + </iframe> |
| 88 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 89 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 90 | + </div> |
| 91 | + <iframe srcdoc="<textarea placeholder='I am in an iframe'></textarea>"></iframe> |
| 92 | + </mat-card-content> |
| 93 | + </mat-card> |
| 94 | + |
| 95 | + <mat-card class="demo-mat-card"> |
| 96 | + <mat-toolbar color="primary">Dynamic page content</mat-toolbar> |
| 97 | + <mat-card-content class="demo-mat-card-content"> |
| 98 | + <button mat-raised-button (click)="toggleFocus(dynamicFocusTrap)"> |
| 99 | + {{dynamicFocusTrap && dynamicFocusTrap.enabled ? "Disable" : "Enable"}} FocusTrap |
| 100 | + </button> |
| 101 | + <div class="demo-focus-trap-region" #dynamicDemoRegion |
| 102 | + [class.demo-focus-trap-enabled]="(dynamicFocusTrap && dynamicFocusTrap.enabled) || false"> |
| 103 | + <textarea class="demo-focus-trap-element" placeholder="One"></textarea> |
| 104 | + <textarea class="demo-focus-trap-element" placeholder="Two"></textarea> |
| 105 | + <button mat-raised-button class="demo-focus-trap-element" (click)="addNewElement()"> |
| 106 | + Click to add more focusable elements to the page |
| 107 | + </button> |
| 108 | + </div> |
| 109 | + <div #newElements></div> |
| 110 | + </mat-card-content> |
| 111 | + </mat-card> |
| 112 | + |
| 113 | + <mat-card class="demo-mat-card"> |
| 114 | + <mat-toolbar color="primary">Dialog-on-dialog</mat-toolbar> |
| 115 | + <mat-card-content class="demo-mat-card-content"> |
| 116 | + <button mat-raised-button (click)="openDialog()">Open dialog</button> |
| 117 | + </mat-card-content> |
| 118 | + </mat-card> |
| 119 | +</div> |
0 commit comments