-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [Obs Alert Rules > Rule Detail][KEYBOARD]: N Alerts and N Active…
… Now elems must both be keyboard focsuable (#186529) Closes: elastic/observability-dev#3371 ## Description The Obs Alert Rule Detail view has a card that is clickable with a focusable element inside it. This is a confusing paradigm and prevents keyboard users from filtering by all alerts because it's not focusable. It would be better to make the two alert number widgets the focusable elements. Screenshot attached below. PR is based on the following comment posted by @1Copenut in elastic/observability-dev#3371 (comment) > @alexwizp Agreed, panels should not be focusable. The highlighted panel is clickable, and that was unexpected. I could click the entire panel, and click the "1 Active now" text to filter by all alerts or active alerts in the table below. > > It would be better to have the "All alerts" text be clickable and focusable, and keep the "1 Active now" clickable and focusable. That way the two text blocks have the interactive behavior, while the panel (card) is just a container. ### Steps to recreate 1. Open the [Obs Alerts](https://keepserverless-qa-oblt-b4ba07.kb.eu-west-1.aws.qa.elastic.cloud/app/observability/alerts) table 2. Click the "Manage Rules" link 3. Create a new rule and verify it appears in the Rules table 4. Click on the rule name to load the Rule Detail view 6. Verify the `1 Active Now` ### What was done?: 1. The click event was **REMOVED** from the panel and has been moved to `All alerts.` 2. `aria-describedby` attributes were added for `AllAlertCounts` and `ActiveAlertCounts` 3. `h3` attributes were replaced to `EuiTitle` in `AllAlertCounts` and `ActiveAlertCounts`
- Loading branch information
Showing
7 changed files
with
132 additions
and
128 deletions.
There are no files selected for viewing
44 changes: 0 additions & 44 deletions
44
...ns_ui/public/application/sections/alert_summary_widget/components/active_alert_counts.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...ers_actions_ui/public/application/sections/alert_summary_widget/components/alert_item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { type MouseEvent, type ReactNode } from 'react'; | ||
import numeral from '@elastic/numeral'; | ||
import { | ||
EuiIcon, | ||
EuiTitle, | ||
EuiText, | ||
EuiTextColor, | ||
EuiFlexItem, | ||
EuiLink, | ||
type EuiTextColorProps, | ||
} from '@elastic/eui'; | ||
import { type AlertStatus } from '@kbn/rule-data-utils'; | ||
import { ALERT_COUNT_FORMAT } from './constants'; | ||
|
||
interface AlertItemProps { | ||
label: string | ReactNode; | ||
count: number; | ||
color: EuiTextColorProps['color']; | ||
alertType?: AlertStatus; | ||
handleClick?: ( | ||
event: MouseEvent<HTMLAnchorElement | HTMLDivElement>, | ||
status?: AlertStatus | ||
) => void; | ||
showWarningIcon?: true; | ||
'data-test-subj'?: string; | ||
} | ||
|
||
export const AlertItem = ({ | ||
label, | ||
count, | ||
handleClick, | ||
alertType, | ||
color, | ||
showWarningIcon, | ||
'data-test-subj': dataTestSubj, | ||
}: AlertItemProps) => { | ||
const content = ( | ||
<> | ||
<EuiTitle size="s"> | ||
<EuiTextColor data-test-subj={dataTestSubj} color={color}> | ||
{numeral(count).format(ALERT_COUNT_FORMAT)} | ||
{count > 0 && showWarningIcon ? ( | ||
<> | ||
| ||
<EuiIcon type="warning" ascent={10} /> | ||
</> | ||
) : null} | ||
</EuiTextColor> | ||
</EuiTitle> | ||
<EuiText size="s" color="subdued"> | ||
{label} | ||
</EuiText> | ||
</> | ||
); | ||
|
||
return ( | ||
<EuiFlexItem style={{ minWidth: 50, wordWrap: 'break-word' }} grow={false}> | ||
{handleClick ? ( | ||
<EuiLink | ||
onClick={(event: React.MouseEvent<HTMLAnchorElement>) => { | ||
handleClick(event, alertType); | ||
}} | ||
> | ||
{content} | ||
</EuiLink> | ||
) : ( | ||
content | ||
)} | ||
</EuiFlexItem> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
...tions_ui/public/application/sections/alert_summary_widget/components/all_alert_counts.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters