[feat](trx-frontend-http): make the SQL label the squelch switch
Clicking SQL turns the squelch on and off. The label and the button beside it said the same thing twice — one naming the control, the other reading "On" or "Off" — where the name itself is the obvious target, and the dot already carries the state: grey when off, green while the gate passes, amber while it holds. The pressed state is on the label, so the switch reads the same to a screen reader as it looks. Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -5343,15 +5343,15 @@ function renderSdrSquelch() {
|
||||
}
|
||||
if (sdrSquelchDbEl) sdrSquelchDbEl.disabled = !sdrSquelchSupported;
|
||||
if (sdrSquelchToggleBtn) {
|
||||
sdrSquelchToggleBtn.textContent = sdrSquelchEnabled ? "On" : "Off";
|
||||
sdrSquelchToggleBtn.setAttribute("aria-pressed", String(sdrSquelchEnabled));
|
||||
sdrSquelchToggleBtn.title = sdrSquelchEnabled ? "Turn the squelch off" : "Turn the squelch on";
|
||||
}
|
||||
const state = !sdrSquelchEnabled ? "off" : (sdrSquelchIsPassing() ? "open" : "closed");
|
||||
if (sdrSquelchStateEl) {
|
||||
sdrSquelchStateEl.dataset.state = state;
|
||||
sdrSquelchStateEl.setAttribute(
|
||||
sdrSquelchStateEl.parentElement?.setAttribute(
|
||||
"aria-label",
|
||||
state === "off" ? "Squelch off" : (state === "open" ? "Squelch open" : "Squelch closed"),
|
||||
state === "off" ? "Squelch off" : (state === "open" ? "Squelch on, open" : "Squelch on, closed"),
|
||||
);
|
||||
}
|
||||
if (squelchLabelEl) squelchLabelEl.textContent = String(sdrSquelchThresholdDb);
|
||||
|
||||
@@ -144,12 +144,12 @@ try {
|
||||
shown: getComputedStyle(line).display !== "none",
|
||||
db: Number(document.getElementById("sdr-squelch-db").value),
|
||||
label: Number(document.getElementById("spectrum-squelch-label").textContent),
|
||||
toggle: document.getElementById("sdr-squelch-toggle").textContent,
|
||||
toggle: document.getElementById("sdr-squelch-toggle").getAttribute("aria-pressed"),
|
||||
top: Math.round(line.getBoundingClientRect().top),
|
||||
};
|
||||
});
|
||||
assert.equal(squelchOn.shown, true, "the threshold line did not appear with the squelch on");
|
||||
assert.equal(squelchOn.toggle, "On", "the toggle did not follow the squelch state");
|
||||
assert.equal(squelchOn.toggle, "true", "the SQL switch did not follow the squelch state");
|
||||
assert.equal(squelchOn.label, squelchOn.db, "the line and the readout disagree on the threshold");
|
||||
|
||||
// Dragging the line down lowers the threshold and tells the server.
|
||||
|
||||
Reference in New Issue
Block a user