mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Add keyboard accessibility controls to the activity items on host details and dashboard pages (#28433)
For [#26505](https://github.com/fleetdm/fleet/issues/26505) This adds keyboard a11y controls to the activity items. We use a button element for the clickable area around a button as this gives us all the default keyboard control functionality out of the box. https://www.loom.com/share/311d684c5df145d1b32b83c8c0285133 - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
37754bdf9c
commit
8a33a07cb1
3 changed files with 34 additions and 15 deletions
1
changes/issue-26505-keyboard-accssibility-to-activites
Normal file
1
changes/issue-26505-keyboard-accssibility-to-activites
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
- add keyboard accessibility controls to activities on dashboard and host details pages
|
||||||
|
|
@ -113,7 +113,10 @@ const ActivityItem = ({
|
||||||
[`${baseClass}__no-details`]: hideShowDetails,
|
[`${baseClass}__no-details`]: hideShowDetails,
|
||||||
});
|
});
|
||||||
|
|
||||||
const onShowActivityDetails = () => {
|
const onShowActivityDetails = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
|
// added this stopPropagation to as there is some weirdness around the event
|
||||||
|
// bubbling up and calling the Modals onEnter handler.
|
||||||
|
e.stopPropagation();
|
||||||
onShowDetails({ type: activity.type, details: activity.details });
|
onShowDetails({ type: activity.type, details: activity.details });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -137,7 +140,8 @@ const ActivityItem = ({
|
||||||
/>
|
/>
|
||||||
<div className={`${baseClass}__avatar-lower-dash`} />
|
<div className={`${baseClass}__avatar-lower-dash`} />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<button
|
||||||
|
disabled={hideShowDetails}
|
||||||
className={`${baseClass}__details-wrapper`}
|
className={`${baseClass}__details-wrapper`}
|
||||||
onClick={onShowActivityDetails}
|
onClick={onShowActivityDetails}
|
||||||
>
|
>
|
||||||
|
|
@ -168,12 +172,17 @@ const ActivityItem = ({
|
||||||
</div>
|
</div>
|
||||||
<div className={`${baseClass}__details-actions`}>
|
<div className={`${baseClass}__details-actions`}>
|
||||||
{!hideShowDetails && (
|
{!hideShowDetails && (
|
||||||
<Button variant="icon" onClick={onShowActivityDetails}>
|
<Button
|
||||||
|
className={`${baseClass}__action-button`}
|
||||||
|
variant="icon"
|
||||||
|
onClick={onShowActivityDetails}
|
||||||
|
>
|
||||||
<Icon name="info-outline" />
|
<Icon name="info-outline" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!hideCancel && (
|
{!hideCancel && (
|
||||||
<Button
|
<Button
|
||||||
|
className={`${baseClass}__action-button`}
|
||||||
variant="icon"
|
variant="icon"
|
||||||
onClick={onCancelActivity}
|
onClick={onCancelActivity}
|
||||||
disabled={disableCancel}
|
disabled={disableCancel}
|
||||||
|
|
@ -186,7 +195,7 @@ const ActivityItem = ({
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&__details-wrapper {
|
&__details-wrapper {
|
||||||
|
all: unset; // reset of all browser default button styles.
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: $pad-medium;
|
gap: $pad-medium;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
@ -45,6 +46,20 @@
|
||||||
padding: $pad-small;
|
padding: $pad-small;
|
||||||
margin-bottom: $pad-large;
|
margin-bottom: $pad-large;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid $ui-vibrant-blue-25;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover, &:focus, &:focus-within {
|
||||||
|
border-radius: $border-radius-large;
|
||||||
|
background-color: $ui-off-white;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.activity-item__action-button {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.premium-icon-tip {
|
.premium-icon-tip {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
|
|
@ -56,16 +71,6 @@
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-radius: $border-radius-large;
|
|
||||||
background-color: $ui-off-white;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
.activity-item__details-actions {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|
||||||
|
|
@ -76,11 +81,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&__details-actions {
|
&__details-actions {
|
||||||
visibility: hidden;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: $pad-medium;
|
gap: $pad-medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__action-button {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
&__close-icon {
|
&__close-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue