-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
* chore: update package lock file * chore: move inputs that do not have attached controls or buttons together * chore: move input group css and remove unneeded css * chore: move text input files * fix: removed and combined stories, deleted mixin, fixed numeric switch input and css cleanup * fix: add attributes and control descriptions, change hashed field to obfuscated field * chore: add disabled, required, and readonly attribute controls * chore: remove phone number css until dropdown patterns are refactored * fix: add readonly parameter to stories and empty doc markdown file * chore: add inputName for search field story * fix: add aria attributes, remove resize property from textarea css and removed disabled cursor property from css * fix: error from using 'class' instead of 'className' in MDX * fix: move aria-label for obfuscated field to js
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Text Fields | ||
|
||
## Purpose | ||
|
||
|
||
## Functional Requirements | ||
|
||
|
||
## Technical Specifications | ||
|
||
|
||
### User Interactions | ||
|
||
|
||
### Responsiveness | ||
|
||
* TBD | ||
|
||
### Accessibility | ||
|
||
* `aria-required` | ||
* `aria-readonly` | ||
* `aria-invalid` | ||
* `aria-hidden` (Error Message?) | ||
* `aria-errormessage` (Error Message?) | ||
|
||
### Usage Notes and Additional Considerations |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class ObfuscatedField { | ||
constructor(component) { | ||
this.input = component; | ||
this.btn = component.nextElementSibling; | ||
|
||
if (this.btn) { | ||
this.btn.setAttribute('aria-pressed', false); | ||
this.btn.setAttribute('aria-label', 'show entry'); | ||
} | ||
|
||
this.addListener(this.btn, this.input); | ||
} | ||
|
||
addListener(btn, input) { | ||
btn.addEventListener('click', (e) => { | ||
if (input.type === 'password') { | ||
input.type = 'text'; | ||
btn.setAttribute('aria-pressed', true); | ||
btn.setAttribute('aria-label', 'hide entry'); | ||
btn.firstElementChild.className = 'fas fa-eye'; | ||
} else { | ||
input.type = 'password'; | ||
btn.setAttribute('aria-pressed', false); | ||
btn.setAttribute('aria-label', 'show entry'); | ||
btn.firstElementChild.className = 'fas fa-eye-slash'; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
export default ObfuscatedField; |