Skip to content

Commit

Permalink
fix: [M3-8743] - fix aria label of action menu in IP address table ro…
Browse files Browse the repository at this point in the history
…w. (#11167)

* fix: [M3-8743] - fix aria label of action menu in IP address table row.

* Added changeset: fix aria label of action menu button in IP address table row.

* Update changeset Description.

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>

* remove the optional chaining '?'

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>

* Make ipAddress prop required.

* remove ipAddress check in condition

Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>

---------

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent d871268 commit a7225f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11167-fixed-1730095848948.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

aria label of action menu button in IP address table row ([#11167](https://github.com/linode/manager/pull/11167))
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { Theme } from '@mui/material/styles';
import type { Action } from 'src/components/ActionMenu/ActionMenu';

interface Props {
ipAddress?: IPAddress | IPRange;
ipAddress: IPAddress | IPRange;
ipType: IPTypes;
isOnlyPublicIP: boolean;
isVPCOnlyLinode: boolean;
Expand Down Expand Up @@ -59,6 +59,14 @@ export const LinodeNetworkingActionMenu = (props: Props) => {
? 'Linodes must have at least one public IP'
: undefined;

const getAriaLabel = (): string => {
if ('address' in ipAddress) {
return `Action menu for IP Address ${ipAddress.address}`;
} else {
return `Action menu for IP Address ${ipAddress.range}`;
}
};

const actions = [
onRemove && ipAddress && !is116Range && deletableIPTypes.includes(ipType)
? {
Expand Down Expand Up @@ -110,10 +118,7 @@ export const LinodeNetworkingActionMenu = (props: Props) => {
);
})}
{matchesMdDown && (
<ActionMenu
actionsList={actions}
ariaLabel={`Action menu for IP Address ${props.ipAddress}`}
/>
<ActionMenu actionsList={actions} ariaLabel={getAriaLabel()} />
)}
</>
) : (
Expand Down

0 comments on commit a7225f0

Please sign in to comment.