Skip to content

Commit

Permalink
fix(a11y) improve several a11y issues
Browse files Browse the repository at this point in the history
Signed-off-by: David Edler <david.edler@canonical.com>
  • Loading branch information
edlerd committed Jan 23, 2024
1 parent 28aa0f5 commit 224632b
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jobs:
run: npx playwright test

- name: Save additional test information
if: always()
run: |
touch playwright-report/info.txt
echo "HTML_REPORT_URL_PATH:$HTML_REPORT_URL_PATH" >> playwright-report/info.txt
Expand All @@ -147,6 +148,7 @@ jobs:
retention-days: 30

- name: Output Report URL as Worfklow Annotation
if: always()
run: |
FULL_HTML_REPORT_URL=https://canonical.github.io/lxd-ui/$HTML_REPORT_URL_PATH
echo "::notice title=Published Playwright Test Report::$FULL_HTML_REPORT_URL"
Expand Down
1 change: 1 addition & 0 deletions src/components/forms/DiskDeviceFormCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const DiskDeviceFormCustom: FC<Props> = ({
id: `devices.${index}.pool`,
appearance: "base",
className: "u-no-margin--bottom",
"aria-label": `Select storage volume`,
}}
>
<Icon name="edit" />
Expand Down
2 changes: 2 additions & 0 deletions src/components/forms/DiskSizeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const DiskSizeSelector: FC<Props> = ({
<Select
id="memUnitSelect"
name="memUnitSelect"
label="Select disk size unit"
labelClassName="u-off-screen"
options={getMemUnitOptions()}
onChange={(e) =>
setMemoryLimit(`${limit.value ?? 0}${e.target.value}`)
Expand Down
2 changes: 2 additions & 0 deletions src/components/forms/MemoryLimitSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ const MemoryLimitSelector: FC<Props> = ({ memoryLimit, setMemoryLimit }) => {
<Select
id="memUnitSelect"
name="memUnitSelect"
label="Select memory size unit"
labelClassName="u-off-screen"
options={getMemUnitOptions()}
onChange={(e) =>
setMemoryLimit({
Expand Down
1 change: 1 addition & 0 deletions src/components/forms/RenameDiskDeviceInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const RenameDiskDeviceInput: FC<Props> = ({
onClick={() => setEditing(true)}
appearance="base"
className="u-no-margin--bottom"
aria-label={`Rename disk device`}
>
<Icon name="edit" />
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/instances/FileRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const FileRow: FC<FileRowProps> = ({ instance, path }) => {
onClick={toggleVisibility}
>
<Icon name={isOpen ? "chevron-up" : "chevron-down"} />
<h3 className="p-code-snippet__title file-row-title">{fileName}</h3>
<h2 className="p-code-snippet__title file-row-title">{fileName}</h2>
</Button>
<a
href={fileUrl}
Expand Down
1 change: 1 addition & 0 deletions src/pages/instances/InstanceSearchFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const InstanceSearchFilter: FC<Props> = ({ instances }) => {

return (
<div className="search-wrapper margin-right u-no-margin--bottom">
<h2 className="u-off-screen">Search and filter</h2>
<SearchAndFilter
existingSearchData={searchParamsToChips(searchParams, QUERY_PARAMS)}
filterPanelData={searchAndFilterData}
Expand Down
1 change: 1 addition & 0 deletions src/pages/networks/forms/IpAddressSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const IpAddressSelector: FC<Props> = ({ id, address, setAddress }) => {
<div className="ip-address-selector ip-address-custom">
<RadioInput
label=""
aria-label="custom"
checked={isCustom}
onChange={() => setAddress("")}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/profiles/ProfileSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ProfileSelector: FC<Props> = ({

return (
<>
<Label forId="profile-1">Profiles</Label>
<Label forId="profile-0">Profiles</Label>
{selected.map((value, index) => (
<div className="profile-select" key={value}>
<div>
Expand Down
12 changes: 5 additions & 7 deletions src/pages/settings/SettingFormCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ const SettingFormCheckbox: FC<Props> = ({
setChecked(String(configField.default) === "true");
};

const label =
configField.key.split(".")?.pop()?.replaceAll("_", " ") ?? configField.key;

return (
<>
<Input
aria-label={configField.key}
label={label}
id={getConfigId(configField.key)}
wrapperClassName="input-wrapper"
type="checkbox"
checked={checked}
onChange={(e) => setChecked(e.target.checked)}
help={
<ConfigFieldDescription
description={configField.longdesc}
className="p-form-help-text"
/>
}
help={<ConfigFieldDescription description={configField.longdesc} />}
/>
<Button appearance="base" onClick={onCancel}>
Cancel
Expand Down
1 change: 1 addition & 0 deletions src/pages/storage/StorageVolumesFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const StorageVolumesFilter: FC<Props> = ({ volumes }) => {

return (
<div className="search-wrapper margin-right u-sv3">
<h2 className="u-off-screen">Search and filter</h2>
<SearchAndFilter
existingSearchData={searchParamsToChips(searchParams, QUERY_PARAMS)}
filterPanelData={searchAndFilterData}
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const attachVolume = async (

export const detachVolume = async (page: Page, volumeDevice: string) => {
await page
.getByRole("row", { name: `${volumeDevice} Detach` })
.getByRole("row", { name: volumeDevice })
.getByTitle("Detach")
.click();
await page
Expand Down

0 comments on commit 224632b

Please sign in to comment.