mirror of
https://github.com/deunix-educ/mediadeck.git
synced 2026-11-25 04:39:42 +01:00
Explain a greyed "Keyboard" button: show the reason on tap and log it
On a fresh install features.text_input is false, so the Keyboard button of the Remote tab was greyed out, with the reason only in a title tooltip that cannot be read on a tablet. - The button now uses aria-disabled instead of disabled (same look); tapping it shows the reason in a toast instead of doing nothing. - The server logs "text entry enabled" or "text entry unavailable: <reason>" at startup. - README (fr/en): text entry is listed as optional and off by default in the installation steps, and the possible reasons are documented. tests/test_ui_text_button.py (real Chromium) and a startup-log test in tests/test_text.py cover it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -863,7 +863,15 @@ class TextPanel {
|
||||
this.dialog = $("text-dialog");
|
||||
this.input = $("text-input");
|
||||
|
||||
$("text-open").addEventListener("click", () => this.open());
|
||||
this.unavailable = null; // raison de l'indisponibilité, ou null
|
||||
$("text-open").addEventListener("click", () => {
|
||||
if (this.unavailable === null) {
|
||||
this.open();
|
||||
} else {
|
||||
// Une infobulle est invisible sur une tablette : un appui sur le bouton grisé dit pourquoi
|
||||
this.toast.show(this.i18n.t("text.unavailable", { reason: this.unavailable }));
|
||||
}
|
||||
});
|
||||
$("text-close").addEventListener("click", () => this.dialog.close());
|
||||
$("text-send").addEventListener("click", () => this.send(false));
|
||||
// La touche « Envoyer » du clavier tactile valide le formulaire : texte puis Entrée
|
||||
@@ -907,9 +915,12 @@ class TextPanel {
|
||||
update(input) {
|
||||
const text = input.text ?? { available: false, reason: "" };
|
||||
const button = $("text-open");
|
||||
button.disabled = !input.available || !text.available;
|
||||
button.title = button.disabled ? this.i18n.t("text.unavailable", { reason: text.reason || input.reason }) : "";
|
||||
if (button.disabled && this.dialog.open) {
|
||||
const unavailable = !input.available || !text.available;
|
||||
// aria-disabled plutôt que disabled : un bouton désactivé ne reçoit aucun appui, donc ne pourrait rien expliquer
|
||||
this.unavailable = unavailable ? text.reason || input.reason || "?" : null;
|
||||
button.setAttribute("aria-disabled", String(unavailable));
|
||||
button.title = unavailable ? this.i18n.t("text.unavailable", { reason: this.unavailable }) : "";
|
||||
if (unavailable && this.dialog.open) {
|
||||
this.dialog.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user