Skip to content
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

explorer: Add accessible name to Gas Used (Progressbar component) #2040

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add accessible name to the gas used progress bar [#2037]
- Add accessible name to the nav bar button on mobile [#2036]
- Implement warning for stale market data [#1892]

Expand All @@ -30,8 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1892]: https://github.com/dusk-network/rusk/issues/1892
[#2025]: https://github.com/dusk-network/rusk/issues/2025
[#2034]: https://github.com/dusk-network/rusk/issues/2034
[#2039]: https://github.com/dusk-network/rusk/issues/2039
[#2036]: https://github.com/dusk-network/rusk/issues/2036
[#2037]: https://github.com/dusk-network/rusk/issues/2037
[#2039]: https://github.com/dusk-network/rusk/issues/2039

<!-- VERSIONS -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ exports[`Block Details > renders the Block Details component 1`] = `
580,718

<div
aria-label="Gas Used"
class="dusk-progress-bar block-details__gas-used"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -982,6 +983,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1169,6 +1171,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1356,6 +1359,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1543,6 +1547,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1730,6 +1735,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1917,6 +1923,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2104,6 +2111,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2291,6 +2299,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2478,6 +2487,7 @@ exports[`Blocks Card > should disable the \`Show More\` button if there is no mo
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2578,6 +2588,7 @@ exports[`Blocks Card > should disable the \`Show More\` button is the card is in
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ exports[`Blocks List > renders the Blocks List component 1`] = `
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ exports[`DataCard > should render the \`DataCard\` in the loading state 1`] = `
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ exports[`Transactions Card > should disable the \`Show More\` button if the card
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
data.transactions.stats.gasLimit) *
100}
className="block-details__gas-used"
ariaLabel="Gas Used"
/>
</svelte:fragment>
</ListItem>
Expand Down
1 change: 1 addition & 0 deletions explorer/src/lib/components/blocks-list/BlocksList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
data.transactions.stats.gasLimit) *
100}
className="blocks-list__gas-used"
ariaLabel="Gas Used"
/>
</svelte:fragment>
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/lib/components/data-card/DataCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{/if}
</header>
{#if loading && !data}
<ProgressBar className="data-card__progress-bar" />
<ProgressBar ariaLabel="Loading" className="data-card__progress-bar" />
{:else if error || hasEmptyData}
<DataAlert on:retry {error} />
{:else if data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ describe("ProgressBar", () => {

it("renders the Stepper component with current percentage set as zero", () => {
const { container } = render(ProgressBar, {
props: { currentPercentage: 0 },
props: { ariaLabel: "Loading", currentPercentage: 0 },
});

expect(container.firstChild).toMatchSnapshot();
});

it("re-renders the Stepper component when the current percentage property changes", async () => {
const { container, rerender } = render(ProgressBar, {
props: { currentPercentage: 0 },
props: { ariaLabel: "Loading", currentPercentage: 0 },
});

expect(container.firstChild).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`ProgressBar > re-renders the Stepper component when the current percentage property changes 1`] = `
<div
aria-label="Loading"
class="dusk-progress-bar"
role="progressbar"
>
Expand All @@ -14,6 +15,7 @@ exports[`ProgressBar > re-renders the Stepper component when the current percent

exports[`ProgressBar > re-renders the Stepper component when the current percentage property changes 2`] = `
<div
aria-label="Loading"
class="dusk-progress-bar"
role="progressbar"
>
Expand All @@ -37,6 +39,7 @@ exports[`ProgressBar > renders the ProgressBar component with no current percent

exports[`ProgressBar > renders the Stepper component with current percentage set as zero 1`] = `
<div
aria-label="Loading"
class="dusk-progress-bar"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
/** @type {string | Undefined} */
export let className = undefined;

/** @type {string} */
export let ariaLabel;

$: classes = makeClassName(["dusk-progress-bar", className]);
</script>

<div role="progressbar" class={classes}>
<div role="progressbar" class={classes} aria-label={ariaLabel}>
<div
style={currentPercentage !== undefined
? `width: ${currentPercentage}%`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down Expand Up @@ -1137,6 +1138,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1324,6 +1326,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1511,6 +1514,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1698,6 +1702,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -1885,6 +1890,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2072,6 +2078,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2259,6 +2266,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2446,6 +2454,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2633,6 +2642,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -2820,6 +2830,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -3007,6 +3018,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -3194,6 +3206,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -3381,6 +3394,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -3568,6 +3582,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down Expand Up @@ -3755,6 +3770,7 @@ exports[`Blocks page > should render the Blocks page, start polling for blocks a
class="details-list__definition details-list__definition--table"
>
<div
aria-label="Gas Used"
class="dusk-progress-bar blocks-list__gas-used"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`Block Details > should render the Block Details page and query the nece
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down Expand Up @@ -55,6 +56,7 @@ exports[`Block Details > should render the Block Details page and query the nece
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down Expand Up @@ -359,6 +361,7 @@ exports[`Block Details > should render the Block Details page and query the nece
580,718

<div
aria-label="Gas Used"
class="dusk-progress-bar block-details__gas-used"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`Transactions page > should render the Transactions page, start polling
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`Transaction Details > should render the Transaction details page and qu
</header>

<div
aria-label="Loading"
class="dusk-progress-bar data-card__progress-bar"
role="progressbar"
>
Expand Down
Loading