Skip to content

Commit

Permalink
fix radio buttons on firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpal committed Oct 30, 2024
1 parent c398df5 commit 5b23b9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions infra/nightly-resources/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ async function load_index() {
selectAllModes(true);
selectAllBenchmarks(true);

// Firefox doesn't handle radio buttons correctly on page reload,
// so manually set to absolute view
document.getElementById("absolute").checked = true;
onRadioClick("absolute");

const previousRuns = await getPreviousRuns();
const initialRunIdx = findBenchToCompareIdx(previousRuns);
loadBaseline(previousRuns[initialRunIdx].url);
Expand Down Expand Up @@ -111,10 +116,10 @@ async function loadBaseline(url) {
refreshView();
}

function onRadioClick(elt) {
GLOBAL_DATA.chart.mode = elt.value;
function onRadioClick(value) {
GLOBAL_DATA.chart.mode = value;
document.getElementById("speedup-formula").style.visibility =
elt.value === "speedup" ? "visible" : "hidden";
value === "speedup" ? "visible" : "hidden";
refreshChart();
}

Expand Down
4 changes: 2 additions & 2 deletions infra/nightly-resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ <h2>Profile</h2>
<div>
<button type="button" class="collapsible" onclick="toggle(this, '\u25B6 Show Chart', '\u25BC Hide Chart')">&#x25BC; Hide Chart</button>
<div class="expanded">
<input onclick="onRadioClick(this);" checked type="radio" id="absolute" name="chart-type" value="absolute">
<input onclick="onRadioClick('absolute');" checked type="radio" id="absolute" name="chart-type" value="absolute">
<label for="absolute">Absolute</label>
<input onclick="onRadioClick(this);" type="radio" id="speedup" name="chart-type" value="speedup">
<input onclick="onRadioClick('speedup');" type="radio" id="speedup" name="chart-type" value="speedup">
<label for="speedup">Speedup</label><br>
<p id="speedup-formula">Speedup = (LLVM-O0 TIME / RUN MODE TIME)</p>
<canvas class="content" id="chart"></canvas>
Expand Down

0 comments on commit 5b23b9d

Please sign in to comment.