-
Notifications
You must be signed in to change notification settings - Fork 58
[OUDS] Show password example #3410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hannahiss
wants to merge
22
commits into
ouds/main
Choose a base branch
from
ouds/main-his-show-passwd
base: ouds/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e87cfe8
Show password example
hannahiss 30e5c71
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 6e17d91
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 6bee9aa
Use sprite for show/hide password icon
hannahiss 1963c9e
Doc
hannahiss e344b5d
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss a5ace19
Right name for icon - oups
hannahiss 2e86994
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 555ebab
Navigation buttons full doc with styles and icons
hannahiss 43f42fd
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 22125eb
Password input live example
hannahiss 842e7ec
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 7f0be2e
Live example inside input password page
hannahiss e5b9474
Live example inside input password page
hannahiss 8a4f21c
.
hannahiss df0cfaf
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 62a071e
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss fe863bc
Change link
hannahiss f4309a6
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss a3589ce
Merge branch 'ouds/main' into ouds/main-his-show-passwd
hannahiss 01b9a58
missing type="button"
hannahiss 5fed7da
missing type="button" + aria-pressed="false"
hannahiss 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| import JsDocs from '@components/shortcodes/JsDocs.astro' | ||
| import { getVersionedDocsPath } from '@libs/path' | ||
|
|
||
| export const title = 'Show password' | ||
| export const extra_css = ['show-password.css'] | ||
| export const extra_js = [{src: 'show-password.js'}] | ||
| export const aliases = [ | ||
| '/examples/show-password', | ||
| '/docs/examples/show-password' | ||
| ] | ||
| --- | ||
|
|
||
| <main class="container-fluid container-max-width"> | ||
| <h1 class="py-medium">Show password button</h1> | ||
|
|
||
| <p>Find here an example of how to implement a password input with a show password button, show/hide the password value and manage the button icon and label, in an accessible way.</p> | ||
|
|
||
| <div class="text-input mb-medium component-max-width"> | ||
| <div class="text-input-container"> | ||
| <label for="inputPassword">Password</label> | ||
| <input type="password" id="inputPassword" class="text-input-field" placeholder=" "> | ||
| <button class="btn btn-minimal btn-icon" id="togglePassword"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href={getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="accordion" id="code-accordion"> | ||
| <div class="accordion-item"> | ||
| <h2 class="accordion-header"> | ||
| <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne"> | ||
| See Javascript code | ||
| </button> | ||
| </h2> | ||
| <div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#code-accordion"> | ||
| <div class="accordion-body border border-subtle p-none"> | ||
| <JsDocs name="show-password" file="site/src/assets/examples/show-password/show-password.js" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| </main> |
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,15 @@ | ||
| .accordion-item { | ||
| max-width: 55rem; | ||
| } | ||
|
|
||
| .accordion-body { | ||
| margin-bottom: 5rem; | ||
| } | ||
|
|
||
| .accordion-body .highlight { | ||
| padding: 24px 24px 0; | ||
| } | ||
|
|
||
| .accordion-collapse { | ||
| background-color: var(--bs-color-bg-secondary); | ||
| } |
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,30 @@ | ||
| // js-docs-start show-password | ||
| // Manage show password button | ||
| (() => { | ||
| 'use strict' | ||
| // Toggle password visibility | ||
| const togglePasswordButton = document.querySelector('#togglePassword') | ||
| if (togglePasswordButton) { | ||
| const passwordInput = document.querySelector('#inputPassword') | ||
| const iconUse = togglePasswordButton.querySelector('use') | ||
| const visuallyHiddenText = togglePasswordButton.querySelector('.visually-hidden') | ||
|
|
||
| togglePasswordButton.addEventListener('click', event => { | ||
| event.preventDefault() | ||
|
|
||
| // Toggle the type attribute to make the password visible or hidden | ||
| const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password' | ||
| passwordInput.setAttribute('type', type) | ||
|
|
||
| // Toggle the icon, the visually-hidden text for accessibility reasons | ||
| if (type === 'text') { | ||
| iconUse.setAttribute('xlink:href', iconUse.getAttribute('xlink:href').replace('accessibility-vision', 'hide')) | ||
| visuallyHiddenText.textContent = 'Hide password' | ||
| } else { | ||
| iconUse.setAttribute('xlink:href', iconUse.getAttribute('xlink:href').replace('hide', 'accessibility-vision')) | ||
| visuallyHiddenText.textContent = 'Show password' | ||
| } | ||
| }) | ||
| } | ||
| })() | ||
| // js-docs-end show-password |
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
Binary file added
BIN
+2.09 KB
site/static/orange-compact/docs/[version]/assets/img/examples/show-password.png
louismaximepiton marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.24 KB
site/static/orange-compact/docs/[version]/assets/img/examples/show-password@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.