Skip to content

Commit 3e38120

Browse files
authored
Merge pull request #13797 from github/repo-sync
repo sync
2 parents 01801f8 + 5bc44c8 commit 3e38120

2 files changed

Lines changed: 43 additions & 29 deletions

File tree

components/Search.tsx

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -209,35 +209,38 @@ export function Search({
209209
<div data-testid="search" aria-hidden="true">
210210
<div className="position-relative z-2">
211211
<form role="search" className="width-full d-flex" noValidate onSubmit={onFormSubmit}>
212-
<input
213-
data-testid="site-search-input"
214-
ref={inputRef}
215-
className={cx(
216-
styles.searchInput,
217-
iconSize === 24 && 'form-control px-6 f4',
218-
iconSize === 16 && 'form-control px-5 f4',
219-
variant === 'compact' && 'py-2',
220-
variant === 'expanded' && 'py-3',
221-
isHeaderSearch && styles.searchInputHeader,
222-
!isHeaderSearch && 'width-full',
223-
isHeaderSearch && query && styles.searchInputExpanded,
224-
isHeaderSearch && query && 'position-absolute top-0 right-0'
225-
)}
226-
style={{
227-
background: `var(--color-canvas-default) url("/assets/images/octicons/search-${iconSize}.svg") no-repeat ${
228-
iconSize === 24 ? '12px' : '6px'
229-
}`,
230-
}}
231-
type="search"
232-
placeholder={t`placeholder`}
233-
autoComplete="off"
234-
autoCorrect="off"
235-
autoCapitalize="off"
236-
spellCheck="false"
237-
maxLength={512}
238-
onChange={onSearch}
239-
value={localQuery}
240-
/>
212+
<label className="text-normal width-full">
213+
<span className="visually-hidden">{t`placeholder`}</span>
214+
<input
215+
data-testid="site-search-input"
216+
ref={inputRef}
217+
className={cx(
218+
styles.searchInput,
219+
iconSize === 24 && 'form-control px-6 f4',
220+
iconSize === 16 && 'form-control px-5 f4',
221+
variant === 'compact' && 'py-2',
222+
variant === 'expanded' && 'py-3',
223+
isHeaderSearch && styles.searchInputHeader,
224+
!isHeaderSearch && 'width-full',
225+
isHeaderSearch && query && styles.searchInputExpanded,
226+
isHeaderSearch && query && 'position-absolute top-0 right-0'
227+
)}
228+
style={{
229+
background: `var(--color-canvas-default) url("/assets/images/octicons/search-${iconSize}.svg") no-repeat ${
230+
iconSize === 24 ? '12px' : '6px'
231+
}`,
232+
}}
233+
type="search"
234+
placeholder={t`placeholder`}
235+
autoComplete="off"
236+
autoCorrect="off"
237+
autoCapitalize="off"
238+
spellCheck="false"
239+
maxLength={512}
240+
onChange={onSearch}
241+
value={localQuery}
242+
/>
243+
</label>
241244
<button className="d-none" type="submit" title="Submit the search query." hidden />
242245
</form>
243246
</div>

stylesheets/utilities.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,14 @@
8383
.min-h-screen {
8484
min-height: 100vh;
8585
}
86+
87+
.visually-hidden {
88+
border: 0;
89+
clip: rect(0 0 0 0);
90+
height: 1px;
91+
margin: -1px;
92+
overflow: hidden;
93+
padding: 0;
94+
position: absolute !important;
95+
width: 1px;
96+
}

0 commit comments

Comments
 (0)