-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: [UX improvement] Enhance accessibility and visual feedback #26
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,6 +225,8 @@ class TryOnYouBunker { | |
| requestPrivatePass() { | ||
| const modal = document.getElementById('private-pass-modal'); | ||
| modal.style.display = 'flex'; | ||
| const input = document.getElementById('private-pass-input'); | ||
| if (input) input.focus(); | ||
|
Comment on lines
+228
to
+229
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ¡Excelente mejora de accesibilidad al mover el foco al Para completar el patrón de accesibilidad de un modal, es crucial devolver el foco al elemento que lo activó cuando el modal se cierra. De lo contrario, el foco se "pierde" en la página (a menudo vuelve al inicio del Para solucionarlo, puedes guardar el elemento activo antes de mostrar el modal y restaurar el foco al cerrarlo. 1. Añade una propiedad en el constructor() {
// ...
this.previouslyFocusedElement = null;
this.init();
}2. Guarda el foco en requestPrivatePass() {
this.previouslyFocusedElement = document.activeElement; // Guardar foco
const modal = document.getElementById('private-pass-modal');
modal.style.display = 'flex';
const input = document.getElementById('private-pass-input');
if (input) input.focus();
}3. Restaura el foco en closePrivatePass() {
const modal = document.getElementById('private-pass-modal');
modal.style.display = 'none';
if (this.previouslyFocusedElement) {
this.previouslyFocusedElement.focus(); // Restaurar foco
}
}Esto asegurará una experiencia de usuario fluida y accesible. |
||
| } | ||
|
|
||
| closePrivatePass() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Para mejorar la accesibilidad y la consistencia, te sugiero los siguientes cambios:
aria-labelconciso: El valor dearia-labeles una instrucción completa. Es mejor que sea una etiqueta concisa, como "Credencial de acceso", ya que el párrafo anterior ya da el contexto.placeholder"Credential ID" está en inglés. SerÃa bueno traducirlo a "ID de Credencial" para que coincida con el resto de la interfaz.Adicionalmente, considera mover los estilos en lÃnea de este elemento a una clase CSS en
styles/main.csspara mejorar la mantenibilidad.