This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(checkbox): handle links in transcluded label in an a11y-friendly way #11154
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<div ng-controller="AppCtrl" class="md-padding" ng-cloak> | ||
<div> | ||
<fieldset class="standard"> | ||
<legend>Using Different Layouts and Labels</legend> | ||
<div layout="column"> | ||
<div class="md-dense" layout="column"> | ||
<md-checkbox ng-model="data.cb1"> | ||
Default Checkbox and Label | ||
</md-checkbox> | ||
<md-checkbox ng-model="data.cb2"> | ||
Dynamic Label: {{data.cb2 ? 'Checked' : 'Unchecked'}} | ||
</md-checkbox> | ||
</div> | ||
<div layout="row" layout-align="start center" class="md-dense"> | ||
<!-- Extra work is needed by the developer to make this work, including a11y. --> | ||
<label for="label-in-front" ng-click="data.cb3 = !data.cb3" | ||
aria-hidden="true" tabindex="-1"> | ||
Label in Front | ||
</label> | ||
<md-checkbox ng-model="data.cb3" id="label-in-front" | ||
aria-label="Label in Front"> | ||
</md-checkbox> | ||
</div> | ||
<md-input-container> | ||
<md-checkbox ng-model="data.cb4"> | ||
Checkbox in an md-input-container | ||
</md-checkbox> | ||
</md-input-container> | ||
<md-subheader>Checkbox with an accessible link in the label</md-subheader> | ||
<md-input-container> | ||
<md-checkbox ng-model="data.cb5"> | ||
I agree to the <a href="/license">license</a>. | ||
</md-checkbox> | ||
</md-input-container> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
angular.module('checkboxDemo1', ['ngMaterial']) | ||
|
||
.controller('AppCtrl', function($scope) { | ||
$scope.data = {}; | ||
$scope.data.cb1 = true; | ||
$scope.data.cb2 = true; | ||
$scope.data.cb3 = false; | ||
$scope.data.cb4 = false; | ||
$scope.data.cb5 = false; | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fieldset.standard { | ||
border: 1px solid; | ||
} | ||
legend { | ||
color: #3F51B5; | ||
} | ||
label { | ||
cursor: pointer; | ||
margin-right: 10px; | ||
user-select: none; | ||
height: 16px; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.