Skip to content

Commit

Permalink
fix: [Search:WebCrawlers:ViewCrawler:Manage Domains page]Incorrect to…
Browse files Browse the repository at this point in the history
…tal number of options announced for Policy and Rules combo box (elastic#199745)

Closes: elastic#199132

## Description
Visible total number of options should the same as announced for the
user as not to confuse them. Especially for the users using assistive
technologies.

## What was changed: 
1. value of `hasNoInitialSelection` attribute value has been updated for
the mentioned cases. This removes the extra selection option from the
DOM and fixes the `a11y` issue.

## Screen:

<img width="1201" alt="image"
src="https://github.com/user-attachments/assets/6cf3dc6f-8664-44a9-baa8-453764098ad9">
  • Loading branch information
alexwizp authored Nov 13, 2024
1 parent 710c4cc commit e967193
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ const DEFAULT_DESCRIPTION = (
defaultMessage="Create a crawl rule to include or exclude pages whose URL matches the rule. Rules run in sequential order, and each URL is evaluated according to the first match. {link}"
values={{
link: (
<EuiLink href={docLinks.appSearchCrawlRules} target="_blank" external>
<EuiLink
data-test-subj="enterpriseSearchLearnMoreAboutCrawlRulesLink"
href={docLinks.appSearchCrawlRules}
target="_blank"
external
>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.crawler.crawlRulesTable.descriptionLinkText',
{ defaultMessage: 'Learn more about crawl rules' }
Expand All @@ -78,9 +83,10 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
{
editingRender: (crawlRule, onChange, { isInvalid, isLoading }) => (
<EuiSelect
data-test-subj="enterpriseSearchColumnsSelect"
fullWidth
hasNoInitialSelection
value={(crawlRule as CrawlRule).policy}
hasNoInitialSelection={!(crawlRule as CrawlRule).policy}
onChange={(e) => onChange(e.target.value)}
disabled={isLoading}
isInvalid={isInvalid}
Expand All @@ -106,9 +112,10 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
{
editingRender: (crawlRule, onChange, { isInvalid, isLoading }) => (
<EuiSelect
data-test-subj="enterpriseSearchColumnsSelect"
fullWidth
hasNoInitialSelection
value={(crawlRule as CrawlRule).rule}
hasNoInitialSelection={!(crawlRule as CrawlRule).rule}
onChange={(e) => onChange(e.target.value)}
disabled={isLoading}
isInvalid={isInvalid}
Expand Down Expand Up @@ -139,6 +146,7 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem>
<EuiFieldText
data-test-subj="enterpriseSearchColumnsFieldText"
fullWidth
value={(crawlRule as CrawlRule).pattern}
onChange={(e) => onChange(e.target.value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ const DEFAULT_DESCRIPTION = (
defaultMessage="Create a crawl rule to include or exclude pages whose URL matches the rule. Rules run in sequential order, and each URL is evaluated according to the first match."
/>
<EuiSpacer size="s" />
<EuiLink href={docLinks.crawlerManaging} target="_blank" external>
<EuiLink
data-test-subj="enterpriseSearchLearnMoreAboutCrawlRulesLink"
href={docLinks.crawlerManaging}
target="_blank"
external
>
{i18n.translate('xpack.enterpriseSearch.crawler.crawlRulesTable.descriptionLinkText', {
defaultMessage: 'Learn more about crawl rules',
})}
Expand All @@ -126,10 +131,11 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
{
editingRender: (crawlRule, onChange, { isInvalid, isLoading }) => (
<EuiSelect
data-test-subj="enterpriseSearchColumnsSelect"
data-telemetry-id="entSearchContent-crawler-domainDetail-crawlRules-policy"
fullWidth
hasNoInitialSelection
value={(crawlRule as CrawlRule).policy}
hasNoInitialSelection={!(crawlRule as CrawlRule).policy}
onChange={(e) => onChange(e.target.value)}
disabled={isLoading}
isInvalid={isInvalid}
Expand All @@ -152,10 +158,11 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
{
editingRender: (crawlRule, onChange, { isInvalid, isLoading }) => (
<EuiSelect
data-test-subj="enterpriseSearchColumnsSelect"
data-telemetry-id="entSearchContent-crawler-domainDetail-crawlRules-rule"
fullWidth
hasNoInitialSelection
value={(crawlRule as CrawlRule).rule}
hasNoInitialSelection={!(crawlRule as CrawlRule).rule}
onChange={(e) => onChange(e.target.value)}
disabled={isLoading}
isInvalid={isInvalid}
Expand Down Expand Up @@ -183,6 +190,7 @@ export const CrawlRulesTable: React.FC<CrawlRulesTableProps> = ({
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem>
<EuiFieldText
data-test-subj="enterpriseSearchColumnsFieldText"
fullWidth
value={(crawlRule as CrawlRule).pattern}
onChange={(e) => onChange(e.target.value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ConnectorFields: React.FC<ActionConnectorFieldsProps> = ({ readOnly, isEdi
'data-test-subj': 'config.apiProvider-select',
options: providerOptions,
fullWidth: true,
hasNoInitialSelection: true,
hasNoInitialSelection: false,
disabled: readOnly,
readOnly,
},
Expand Down

0 comments on commit e967193

Please sign in to comment.