Skip to content

Commit

Permalink
Accessibility on search input + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kreafox committed Apr 5, 2023
1 parent 70e7d89 commit 87f1451
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 62 deletions.
3 changes: 2 additions & 1 deletion searchlib/components/Facets/Unconnected/BooleanFacet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const BooleanFacetComponent = (props) => {
<div className="boolean-facet" {...domProps} id={id}>
<Radio
toggle
label={textLabel}
name={`field-${id}`}
label={<label htmlFor={`field-${id}`}>{textLabel}</label>}
checked={value}
onChange={(e, { checked }) => {
if (checked) {
Expand Down
2 changes: 1 addition & 1 deletion searchlib/components/FilterList/ActiveFilterValue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ActiveFilterValue = (props) => {
<div className="filter-label">{activeFilterLabel || label}:</div>
{values?.map((value, index) => {
return (
<Label basic className="filter-value">
<Label basic className="filter-value" key={index}>
<span>
{value?.type === 'range' ? (
<>
Expand Down
56 changes: 29 additions & 27 deletions searchlib/components/SearchInput/SearchInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,15 @@ function SearchInput({
''
)}

<div className="input-controls">
{(searchTerm || '').trim() && (
<>
<Button
basic
className="clear-button"
onClick={() => {
// inputProps.onChange({ target: { value: '' } });
setSearchTerm('', { shouldClearFilters: false });

const sNew = sortOptions.filter((s) => s.name === 'Newest');
if (sNew.length > 0) {
setSort(sNew[0].value, sNew[0].direction);
}
// onSubmit();
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
<div className="terms-box-left">
<div className="input-controls">
{(searchTerm || '').trim() && (
<>
<Button
basic
className="clear-button"
onClick={() => {
// inputProps.onChange({ target: { value: '' } });
setSearchTerm('', { shouldClearFilters: false });

const sNew = sortOptions.filter(
Expand All @@ -158,16 +149,27 @@ function SearchInput({
if (sNew.length > 0) {
setSort(sNew[0].value, sNew[0].direction);
}
}
}}
>
<Icon name="close" />
</Button>
</>
)}
</div>
// onSubmit();
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
setSearchTerm('', { shouldClearFilters: false });

const sNew = sortOptions.filter(
(s) => s.name === 'Newest',
);
if (sNew.length > 0) {
setSort(sNew[0].value, sNew[0].direction);
}
}
}}
>
<Icon name="close" />
</Button>
</>
)}
</div>

<div className="terms-box-left">
<div
tabIndex={0}
role="button"
Expand Down
19 changes: 7 additions & 12 deletions src/SearchBlock/less/dropdown-filterlist.less
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@
color: @pineGreen !important;
}

.ui.accordion .title i:before {
font-size: 2rem;
.ui.accordion {
padding-right: 0.2rem;
padding-left: 0.2rem;

.title i:before {
font-size: 2rem;
}
}
}
}
Expand Down Expand Up @@ -293,10 +298,6 @@
height: 15px;
border: 1px solid @darkCerulean;
background-color: @white;

// &:focus-visible {
// border: 1px solid red;
// }
}

.radio-checkmark {
Expand Down Expand Up @@ -395,12 +396,6 @@
margin: 0;
background-color: transparent;
font-size: 80%;

&:focus,
&:focus-visible {
border: none;
outline: none;
}
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/SearchBlock/less/facets.less
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,6 @@
margin-bottom: 0.2em;
border-radius: 5px;
font-size: 80%;

&:focus-visible {
outline: none;
}
}

span.label {
Expand Down
19 changes: 12 additions & 7 deletions src/SearchBlock/less/searchbox.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.sui-search-box {
position: relative;
margin: 3em 0 2em 0;
margin: 2em 0;

.search-input {
display: flex;
Expand All @@ -14,12 +14,12 @@
display: flex;
width: 100%;
border: none;
border-bottom: 2px solid @secondaryColor;

.terms-box-left {
display: flex;
flex-grow: 0;
align-items: center;
border-bottom: 2px solid @secondaryColor;

.search-icon {
width: 29px;
Expand All @@ -36,13 +36,18 @@
input {
width: calc(100% - 55px);
border: none;
border-bottom: 2px solid @secondaryColor;
color: @deepBlue;
font-family: @headerFont;
font-size: 40px;

&:focus-visible {
border: none !important;
outline: none;
&:focus {
border-bottom: 3px solid #0083e0;
outline: none !important;

&:focus + .terms-box-left {
border-bottom: 3px solid #0083e0;
}
}
}

Expand All @@ -68,8 +73,8 @@
.input-controls {
display: flex;
align-items: center;
margin-top: 2px;
margin-left: auto;
// margin-top: 2px;
// margin-left: auto;

.clear-button {
position: relative;
Expand Down
18 changes: 8 additions & 10 deletions src/SearchBlock/less/searchview.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
body.view-viewview {
.searchlib-block {
*:focus-visible {
outline: var(--focus-visible, @focusVisibleOutline) !important;
}
}
}

body.searchlib-page {
overflow-x: hidden !important;

Expand All @@ -19,6 +11,8 @@ body.searchlib-page {
color: @deepBlue;

.back-link {
display: inline-block;
margin: 1em 0;
color: @deepBlue;
font-weight: 500;
}
Expand Down Expand Up @@ -187,10 +181,14 @@ body.searchlib-page {
position: relative;
top: -1px;

.ui.toggle.checkbox input:focus + label:before {
outline: 0.2rem solid #0083e0 !important;
}

label {
padding-left: 2.1rem;
color: @sf-dark-gray !important;
font-size: 12px !important;
color: @deepBlue;
font-size: 14px;

&:before {
position: absolute;
Expand Down

0 comments on commit 87f1451

Please sign in to comment.