When to use it#
- Use it when a visitor knows an address and the answer should appear in your service: on a map, such as the recycling stations around their home, or in a form, where it fills in the address boxes. The visitor types a street, a postal code or a place, and picks an address from a list.
- In a form, AddressInput with a geocoder also suggests addresses in its street box. Use AddressSearch for a search of its own, above the boxes or beside a map. Not for an address the visitor knows by heart: use AddressInput alone, since a lookup adds a step and a third party.
- Not for anything other than addresses, such as case numbers or people: use a Combobox over your own data. Not for searching the pages of a site.
- A geocoder that says it allows search as you type (
suggest: true) is searched about 0.4 seconds after the last key, and the field has no Search button. Any other geocoder is searched when the visitor presses Enter or Search, and typing sends nothing.debounce={false}turns search as you type off for any geocoder. - What the visitor types, and their IP address, go to the geocoder you choose. Choose one whose terms allow your use. A public Nominatim server does not allow search as you type, and Google’s terms limit how you may show and keep its results. KvirnUI recommends neither for forms that residents fill in. It names no service and has no default.
Example#
Type at least 3 characters of a street, postal code or place. Then choose an address from the list.
What you type is sent to Kvirn’s map service to find the address. © OpenStreetMap contributors
No address is chosen.
import { AddressSearch } from '@kvirn-ui/map'
import type { AddressResult } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn'
import { Stack } from '@kvirn-ui/react'
import { useState } from 'react'
import { useAddressSearchTexts } from './texts.ts'
// Made once, outside the component, so the field gets the same geocoder on every render.
// This example searches Sweden only.
const geocoder = kvirnGeocoder({
url: 'https://geo.kvirn.com',
name: 'Kvirn’s map service',
countries: ['se'],
})
export function DefaultAddressSearch() {
const { texts } = useAddressSearchTexts()
const [chosen, setChosen] = useState<AddressResult | null>(null)
return (
<Stack className="kv-stack--gap-8">
<search>
<AddressSearch geocoder={geocoder} onResult={setChosen} />
</search>
<p>
{chosen === null
? texts.nothingChosen
: texts.chosen(chosen.label, chosen.position.latitude, chosen.position.longitude)}
</p>
</Stack>
)
}The examples on this page send what you type to geo.kvirn.com, Kvirn’s own address service, hosted in the EU and setting no cookies. Your text and your IP address reach it, and only once you type (in the fault example, once you press Enter or Search). Don’t type your own address. Try a Swedish street and town, such as Drottninggatan 6, Stockholm. The map example also loads its map from geo.kvirn.com as soon as it is shown.
Information: Did you know?
Name your address service in your privacy notice: the text typed and the visitor’s IP address reach it (GDPR). The field already says where the text goes. A screen reader reads that notice when the field gets focus.
Use cases#
Find recycling stations near your home
A resident types their address. The map moves to it and draws a pin, and the list under the map shows the recycling stations now in view. The zoom out button shows more. Picking an address does not move focus, so the resident stays in the field. The search sits inside Map.Root, before the map, and calls show and clearResult from useMapState. Once the map has moved, a screen reader says “The map shows the address.” and how many places are in view. See What a screen reader reads.
import { AddressSearch, Map, useMapState } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn'
import { DocsMap } from '../map/use-docs-provider.tsx'
import { useAddressSearchTexts } from './texts.ts'
const initialView = { center: { longitude: 18.07, latitude: 59.33 }, zoom: 13 }
const geocoder = kvirnGeocoder({
url: 'https://geo.kvirn.com',
name: 'Kvirn’s map service',
countries: ['se'],
})
// The search must sit inside Map.Root to reach the map, and before the map in the page.
function FindAddress() {
const map = useMapState()
return (
<search>
<AddressSearch
geocoder={geocoder}
onResult={(result) => (result ? map.show(result) : map.clearResult())}
/>
</search>
)
}
export function RecyclingStationSearch() {
const { texts } = useAddressSearchTexts()
return (
<DocsMap>
{(provider) => (
<Map.Root
provider={provider}
label={texts.mapLabel}
places={texts.stations}
initialView={initialView}
>
<FindAddress />
<Map.Skip />
<Map.Viewport>
<Map.Markers />
<Map.Controls />
<Map.Attribution />
</Map.Viewport>
<Map.List headingLevel="h4" />
<Map.Details />
</Map.Root>
)}
</DocsMap>
)
}Props in this example:
Warning: Don't forget
Keep the Map list on the page. The pin is decoration. The list and the details are how everyone reaches a place (2.1.1 Keyboard, 1.1.1 Non-text Content).
Report a fault near an address
A resident reports a broken street light. They search for the street, and the town if they know it, and the report keeps the address and its position. This geocoder allows search as you type, but debounce={false} makes the field search on request: typing sends nothing, the field has a Search button, and the text is sent only when the resident presses Enter or Search. The resident then picks an address from the list.
Type the street, and the town if you can. Then press Search.
What you type is sent to Kvirn’s map service to find the address. © OpenStreetMap contributors
No address is chosen.
import { AddressSearch } from '@kvirn-ui/map'
import type { AddressResult } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn'
import { Stack } from '@kvirn-ui/react'
import { useState } from 'react'
import { useAddressSearchTexts } from './texts.ts'
const geocoder = kvirnGeocoder({
url: 'https://geo.kvirn.com',
name: 'Kvirn’s map service',
countries: ['se'],
})
export function FaultAddressSearch() {
const { texts } = useAddressSearchTexts()
const [place, setPlace] = useState<AddressResult | null>(null)
return (
<Stack className="kv-stack--gap-8">
<search>
{/* This geocoder allows search as you type. debounce={false} searches on request instead:
nothing is sent until the visitor presses Enter or Search. */}
<AddressSearch
geocoder={geocoder}
debounce={false}
label={texts.faultLabel}
messages={{ helpRequest: texts.faultHelp }}
onResult={setPlace}
/>
</search>
<p>{place === null ? texts.noPlace : texts.faultAt(place.label)}</p>
</Stack>
)
}Props in this example:
geocoderon AddressSearchdebounceon AddressSearchlabelon AddressSearchmessageson AddressSearchonResulton AddressSearch
Information: Implement like this
To search your own register instead of a public service, write the geocoder yourself. Pass signal to fetch, so a new search cancels the old one. Give each address a full label with the town.
const geocoder: GeocoderProvider = {
name: 'our address register',
search: async (query, { signal }) => {
const response = await fetch(`/api/addresses?q=${encodeURIComponent(query)}`, { signal })
if (!response.ok) throw new Error('Address search failed')
return response.json() // AddressResult[]: { id, label, position: { longitude, latitude } }
},
}Report a change of address with a search above the boxes
A resident reports a new address. They search first, and a pick fills the street, the postal code and the town. The example leaves line 2 alone. The boxes stay editable, so the resident can correct them or skip the search. Enter in the search looks up and does not send the form: the Report the change button does. A pick that has no postal address, such as a park, is turned down with describePick: the list stays open and a message says that nothing is filled in. Only a real address says that the boxes are filled in. The box validation is left out here; see Fix the boxes that are wrong on the AddressInput page. After a pick, a screen reader says “Chosen:”, the address, and “The address is filled in below. Check it before you continue.” See What a screen reader reads.
import { AddressSearch } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn'
import { AddressInput, Button, Field, Fieldset, Stack } from '@kvirn-ui/react'
import { useState } from 'react'
import { useAddressSearchTexts } from './texts.ts'
const geocoder = kvirnGeocoder({
url: 'https://geo.kvirn.com',
name: 'Kvirn’s map service',
countries: ['se'],
})
const emptyAddress = { line1: '', line2: '', postalCode: '', city: '' }
export function ChangeOfAddressSearch() {
const { texts } = useAddressSearchTexts()
const [address, setAddress] = useState(emptyAddress)
const [isReported, setIsReported] = useState(false)
return (
<Stack className="kv-stack--gap-8">
<form
noValidate
onSubmit={(event) => {
event.preventDefault()
setIsReported(true)
}}
>
<Fieldset.Root>
<Fieldset.Legend>{texts.legend}</Fieldset.Legend>
<AddressSearch
geocoder={geocoder}
label={texts.formSearchLabel}
messages={{ helpSuggest: ({ min }) => texts.helpInForm(min) }}
// A result without an address, such as a park, fills nothing, so it is turned down
// and the visitor is told. Only an address says that the boxes are filled in.
describePick={(result) =>
result.address
? { announcement: texts.pickedInForm(result.label) }
: { rejected: texts.noAddress }
}
onResult={(result) => {
if (result?.address) {
const { line1, postalCode, city } = result.address
setAddress((current) => ({ ...current, line1, postalCode, city }))
}
}}
/>
<AddressInput.Root country="SE">
<Field.Root required>
<Field.Label>{texts.street}</Field.Label>
<AddressInput.Line1
name="line1"
value={address.line1}
onChange={(event) => setAddress({ ...address, line1: event.target.value })}
/>
</Field.Root>
<Field.Root>
<Field.Label>{texts.line2}</Field.Label>
<AddressInput.Line2
name="line2"
value={address.line2}
onChange={(event) => setAddress({ ...address, line2: event.target.value })}
/>
</Field.Root>
<Field.Root required>
<Field.Label>{texts.postalCode}</Field.Label>
<AddressInput.PostalCode
name="postalCode"
value={address.postalCode}
onChange={(event) => setAddress({ ...address, postalCode: event.target.value })}
/>
</Field.Root>
<Field.Root required>
<Field.Label>{texts.city}</Field.Label>
<AddressInput.City
name="city"
value={address.city}
onChange={(event) => setAddress({ ...address, city: event.target.value })}
/>
</Field.Root>
</AddressInput.Root>
</Fieldset.Root>
<Button type="submit" className="kv-button--primary">
{texts.reportChange}
</Button>
</form>
<output>{isReported ? texts.changeReported : null}</output>
</Stack>
)
}Props in this example:
geocoderon AddressSearchlabelon AddressSearchmessageson AddressSearchdescribePickon AddressSearchonResulton AddressSearch
Warning: Don't forget
Keep the address boxes editable and the search optional. A lookup can fail or find nothing, and nobody should have to type an address twice (3.3.7 Redundant Entry).
Accessibility#
What it does for you#
- Scope: AddressSearch, an Autocomplete over the answers of a geocoder (a service that turns typed text into addresses). A visitor types a street, a postal code or a place, searches, and picks an address.
onResultgets the address with its position. The roles, states and keys of the field, the popup and the suggestions come from the Autocomplete and are tested there. This page lists what AddressSearch adds. - APG pattern: Combobox: Editable Combobox With List Autocomplete, through Autocomplete (
aria-autocomplete="list", manual selection). - Deviations: one, approved by the maintainer (2026-10-19). Enter with no suggestion active, while no text is being composed with an input method (the way some languages are typed), searches and calls
preventDefault, so it never submits a form: the text is a lookup, not an answer. The form's own submit button sends it. Enter on an active suggestion picks it, as in the APG. - Native elements used:
<input type="text" role="combobox">,<label for>,<div popover="manual">,<div role="listbox">,<div role="option">,<button type="button">(Clear, Search).
You choose the geocoder. The library names no web address and sends nothing until the visitor types and, on request, presses Search.
| Part | Element / role | ARIA / state | Notes |
|---|---|---|---|
| AddressSearch.Root | a Field.Root (<div class="kv-address-search">) | data-status: idle, too-short, searching, results, empty, error, offline, selected, rejected | Owns geocoder, onResult, minLength, debounce, timeoutMilliseconds, country, limitToCountry, describePick, initialText, disabled, id, messages; none reaches the DOM. Put it in <search> beside a map, not in a form |
| AddressSearch.Label | <label for> | none | The visible name. Default addressSearch.label. No required or optional marker |
| AddressSearch.Input | <input type="text" role="combobox"> | the Autocomplete's; aria-describedby the help text, then the notice | autocomplete="off" |
| AddressSearch.Clear | <button type="button" tabindex="-1"> | named by combobox.clear and the label | Empties the text, calls onResult(null), focus stays on the input |
| AddressSearch.Submit | <button type="button"> | none; named by its text, addressSearch.submit | Rendered only on request. Never submits a form |
| AddressSearch.HelpText | <p> (Field help text) | none | addressSearch.helpRequest or helpSuggest |
| AddressSearch.Notice | <p> (Field help text) | none | Says where the text goes (addressSearch.privacy), then the geocoder's attribution |
| AddressSearch.Popup | <div popover="manual"> | the Autocomplete's | The status line, then the suggestions |
| AddressSearch.Status | <div>, plain text with an icon | data-state: too-short, searching, empty, error, offline, rejected; never a live region | Searching, too short, no result, error, offline, a pick describePick rejected. Said again through the Announcer |
| AddressSearch.List / Option | role="listbox" / role="option" | the Autocomplete's; aria-selected="false" always | The option text is the geocoder's label |
Rules, tested in address-search.test.tsx:
- The ARIA 1.2 combobox, named by the visible label, described by the help text and then the notice (
address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice). - Nothing is sent on mount, on focus or with empty text (
address-search.test.tsx › nothing is sent on mount, focus or with empty text). - As you type is used only when the geocoder declares
suggest: true: belowminLengthnothing is sent or announced (address-search.test.tsx › below minLength no request is sent and nothing is announced), one request follows a pause, not each key (address-search.test.tsx › one request after the debounce of no typing, not one per keystroke), a new key abandons the request in flight and a late answer for old text is never shown (address-search.test.tsx › a new keystroke aborts the request in flight and a late answer for old text is never shown), and the request carries the intent and the provider's locale (address-search.test.tsx › passes the intent suggest as you type and submit for Enter, with the provider locale). - On request (a geocoder without
suggest, ordebounce={false}): typing sends nothing, and Enter or Search sends one request (address-search.test.tsx › typing sends nothing, and Enter or Search sends one request (a geocoder without suggest),address-search.test.tsx › typing sends nothing with debounce={false} although the geocoder suggests). BelowminLengthit says what is missing and sends nothing (address-search.test.tsx › Enter or Search below minLength shows and announces tooShort and sends nothing). - Every state has words, and the same words are announced once (4.1.3): searching keeps the earlier options (
address-search.test.tsx › searching shows the status, announces searching and keeps the earlier options in place), n results (address-search.test.tsx › n results are listed, the count is announced once after the answer and nothing is active), none, which is not invalid (address-search.test.tsx › no results shows and announces noResults with the query, reports collapsed and is not invalid), a rejection (address-search.test.tsx › a rejection shows and announces error, and the text stays), no answer in time (address-search.test.tsx › no answer within the timeout shows and announces error) and offline, with no request sent (address-search.test.tsx › offline shows and announces offline and sends no request). The Autocomplete's own count and "No results" are switched off (announceResults={false}), so nothing is said twice. - A pick puts the label in the field, calls
onResultonce, keeps focus on the input and announcesaddressSearch.picked(3.2.2, 4.1.3): with Enter, Alt+ArrowUp or a press. A suggestion without a position is resolved first (address-search.test.tsx › a suggestion without a position is resolved on pick: searching shows, resolve runs once and onResult gets the position;address-search.test.tsx › a resolve that fails shows error and calls no onResult). - With a map,
show(result)fits the bounds or centres, draws a decorative result pin, keeps focus and announcesmap.addressShownonce the view settles (address-search.test.tsx › show(result) fits the bounds or centres, draws the pin, keeps focus and announces addressShown once settled).clearResult()removes the pin and announces nothing (address-search.test.tsx › clearResult removes the pin and announces nothing). - In a form,
result.addressfills the AddressInput boxes, which stay editable (3.3.7;address-search.test.tsx › the result address fills the boxes, which stay editable). data-statusanddata-statecarry the state (address-search.test.tsx › Root data-status follows the state, and Status data-state names the state its words describe). The Status line is absent foridle,resultsandselected.- Root options reach the search and not the DOM:
countryis sent to the geocoder,limitToCountrydrops answers in another country,describePickdecides what a pick says andinitialTextstarts the input (address-search.test.tsx › country is sent to the geocoder and is not a DOM attribute,› limitToCountry drops the answers in another country and is not a DOM attribute,AddressSearch read aloud › a pick with describePick says its announcement in place of chosen,› initialText is the text the input starts with and is not a DOM attribute). - Every string comes from
addressSearch.*and is overridable per instance (address-search.test.tsx › every string comes from addressSearch.* and is overridable per instance,address-search.test.tsx › a per-instance message replaces the catalog text).
What you need to do#
- Name where the text goes. The notice names the geocoder (
name) and carries itsattribution. Name the service in your privacy notice too (GDPR): the typed text and the visitor's IP address reach it. - Choose a geocoder that allows your use. Set
suggest: trueonly if its terms allow a request per pause in typing. A public Nominatim server does not. - Keep the boxes. In a form, keep the address boxes editable and the search optional: a lookup can fail, and the visitor must be able to type the address (3.3.7).
- Put the search where the result lands. Before the map, or above the address boxes, in that reading order. Wrap it in
<search>beside a map, and not inside a form. - Keep the list on the map. The result pin is decoration; the map's list and details remain the way to reach places.
Warning: Don't forget
Put the search where its result lands: before the map, or above the address boxes. The reading order and the Tab order then follow the task (2.4.3 Focus Order).
Visual and modes#
Field, Clear, the focus indicator and the popup are the Autocomplete's (kv-autocomplete-*; see autocomplete.a11y.md). AddressSearch adds the Search button, the status line, the notice and, beside a map, the result pin.
- Focus. The Search button shows a ring in the focus colour, drawn inside its edge, and the input keeps the Autocomplete's ring. The focus colour is checked against the field's surface by
theme:check(2.4.7, 1.4.11). - Target size. Clear is as high as the control, 44px (32px compact), and Search at least 40px (28px compact) high, both at least 44px wide (32px compact), so above 24 × 24 CSS px (2.5.8). Axe's
target-sizerule checks them in the stories. - Reflow. The label, help text and notice wrap. The control wraps: the input keeps at least 10 characters, then Search drops below it, so nothing is clipped at 320px or at 400% zoom (1.4.10). The words do not depend on spacing (1.4.12).
- Not colour alone. Each state has words in the status line, with a spinner (searching), the error icon (error) or the info icon (offline) beside them. The other states are words only (1.4.1).
- Result pin.
kv-map-search-resultis decorative andaria-hidden, not interactive, and has a canvas-coloured edge and dot so it reads on any tile (1.4.11). - Forced colours. Search uses
ButtonFaceandButtonTextwith aButtonBorderdivider, disabled isGrayText, and the pin isCanvasTextwith aCanvasedge. The status icons use the text colour. - Reduced motion. The spinner is the library's, and it turns only under
prefers-reduced-motion: no-preference. Under reduced motion the map jumps to the address. - Right-to-left. Clear, then Search, sit at the inline end. The pin is placed from the map's own coordinates and does not flip.
Focus management#
- Initial focus: not moved. A result, an error and the map moving never take focus.
- Trap: no. The popup is not modal, and Tab always leaves the input (2.1.2).
- Restore to: the input, which never lost focus. A pick, Clear and Escape keep it there.
- Never obscured by: the popup is placed under the Control and flips above it when there is no room (2.4.11).
WCAG success criteria#
- 1.1.1 Non-text Content (A): the pin is decorative and the map's list stays the equivalent (
address-search.test.tsx › show(result) fits the bounds or centres, draws the pin, keeps focus and announces addressShown once settled). - 1.3.1 Info and Relationships (A), 4.1.2 Name, Role, Value (A): the combobox, its label and its description (
address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice). - 1.4.1 Use of Color (A): every state has words (the states and announcements tests, and
address-search.test.tsx › Root data-status follows the state, and Status data-state names the state its words describe). - 1.4.3 Contrast (Minimum) (AA), 1.4.11 Non-text Contrast (AA): the text, border and focus pairs are the theme's, checked by
theme:check. No new pair. - 1.4.10 Reflow (AA), 1.4.12 Text Spacing (AA): the
reflowandtext-spacingsweep projects run the stories (themapfolder is insweepComponents). No unit test. - 2.1.1 Keyboard (A), 2.4.3 Focus Order (A): every row of the Keyboard table names a test.
- 2.1.2 No Keyboard Trap (A): Tab leaves the input, with the popup open or closed (
autocomplete.test.tsx › Tab closes the popup without picking the active suggestion, and moves focus on). - 2.4.6 Headings and Labels (AA), 2.5.3 Label in Name (A): the visible label is the name, and Search is named by its text (
address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form). - 2.4.7 Focus Visible (AA), 2.4.11 Focus Not Obscured (Minimum) (AA): the ring and the popup placement are the Autocomplete's, tested there. The Search button's ring is in the theme and is not asserted by a test.
- 2.5.8 Target Size (Minimum) (AA): Clear and Search are at least 40px (28px compact). Axe's
target-sizerule runs in every story of thereflowsweep, which caught and proved it. - 3.2.1 On Focus (A), 3.2.2 On Input (A): focus and typing change nothing, and a pick, a search and a map move keep focus and never submit a form (
address-search.test.tsx › nothing is sent on mount, focus or with empty text,address-search.test.tsx › Enter with no suggestion active, inside a form, searches now and the form does not submit). - 3.3.2 Labels or Instructions (A): the help text says what to type (
address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice). - 3.3.7 Redundant Entry (A): the address fills the boxes, which stay editable (
address-search.test.tsx › the result address fills the boxes, which stay editable). - 4.1.3 Status Messages (AA): every state is announced once (the tests under Every state has words, and the Read aloud table).
1.3.5 Identify Input Purpose does not apply: the lookup is not a known purpose, so the input has autocomplete="off". The AddressInput boxes carry the tokens.
Keyboard#
- Focus
- aria-activedescendant. DOM focus stays on the input, and the active suggestion is
aria-activedescendant - Selection follows focus
- no (Enter, Alt+ArrowUp or a press picks a suggestion, and the arrow keys only move the highlight)
- Arrows wrap
- no
- Shortcuts
- none
| Key | Where | What happens |
|---|---|---|
| Tab | before the search | Moves focus to the input, one stop. Clear is not a stop Test: autocomplete.test.tsx › Tab moves to the input, one stop |
| Tab | on the input, on request | Moves focus to the Search button, then on. In as-you-type mode there is no button Test: address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form |
| Shift+Tab | on the Search button | Moves focus back to the input Test: address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form |
| Shift+Tab | on the input | Moves focus to the previous focusable element Test: autocomplete.test.tsx › Shift+Tab leaves the input backwards |
| Enter | on the input, no suggestion active | Searches now, flushing the debounce, and never submits a form Test: address-search.test.tsx › Enter with no suggestion active, standalone, searches now and flushes the debounce |
| Enter | on the input in a form, no suggestion active | Searches now. The form is not submitted: its own submit button sends it Test: address-search.test.tsx › Enter with no suggestion active, inside a form, searches now and the form does not submit |
| Enter | on the input, text unchanged since the answer | Opens the last list without activating a suggestion, and says the count again Test: address-search.test.tsx › Enter on text unchanged since the last answer reopens the list without activating it and says the count again |
| Enter / Space | on the Search button | Searches with the text in the field Test: address-search.test.tsx › typing sends nothing, and Enter or Search sends one request (a geocoder without suggest) |
| Enter | popup open, a suggestion is active | Picks it: the label fills the input, the popup closes, focus stays Test: address-search.test.tsx › pick with Enter: the text becomes the label, onResult is called once, focus stays and picked is announced |
| Alt+ArrowUp | popup open, a suggestion is active | Picks it, as Enter does Test: address-search.test.tsx › pick with Alt+ArrowUp: the text becomes the label, onResult is called once, focus stays and picked is announced |
| ArrowDown / ArrowUp | popup open | Activates the next or the previous suggestion. Stops at the ends Test: autocomplete.test.tsx › arrows move the active suggestion and stop at the ends, and typing clears it |
| PageDown / PageUp | popup open | Moves the active suggestion ten on or back Test: autocomplete.test.tsx › PageDown and PageUp move ten suggestions and stop at the ends |
| Home / End | on the input | Move the caret, as in any input. No suggestion stays active Test: autocomplete.test.tsx › Home, End, ArrowLeft, ArrowRight and Space are left to the input: the caret moves, and no suggestion stays active |
| Escape | popup open | Closes the popup. The text stays, and so does focus Test: autocomplete.test.tsx › the text is never cleared silently: Escape and Tab keep it |
| Tab | popup open | Closes the popup without picking, keeps the text, and moves focus on Test: autocomplete.test.tsx › Tab closes the popup without picking the active suggestion, and moves focus on |
| Shift+Tab | popup open | Closes the popup without picking, and moves focus back Test: autocomplete.test.tsx › Shift+Tab closes the popup without picking and moves focus back |
| Pointer press | on a suggestion | Picks it, and keeps focus on the input Test: address-search.test.tsx › pick by press: the text becomes the label, onResult is called once, focus stays and picked is announced |
| Pointer press | on Clear | Empties the text, calls onResult(null) and keeps focus on the inputTest: address-search.test.tsx › Clear empties the text, calls onResult(null) and leaves focus on the input |
The input is one Tab stop and Clear is not (tabindex="-1"). Nothing here moves focus on its own: a pick, a search and a map that moves leave focus in the field (3.2.2). A key that is not in this table is left to the browser.
Information: Did you know?
Enter with no suggestion chosen searches and never sends the form around the field. The form’s own submit button sends it. Keep that button visible, so the form can always be sent with the keyboard.
Announcements#
AddressSearch tells screen reader users about these changes without moving focus. Each message waits until the screen reader is quiet (polite) or interrupts it (assertive).
| When | What it says | Message key | Politeness |
|---|---|---|---|
Enter or Search with fewer than minLength characters | addressSearch.tooShort | Polite | |
| A request is on its way (dropped if the answer comes first) | addressSearch.searching | Polite | |
| The answer has addresses | addressSearch.resultCount | Polite | |
| The answer has none | addressSearch.noResults | Polite | |
| The search fails or gets no answer in time | addressSearch.error | Polite | |
| The browser is offline when a search is sent | addressSearch.offline | Polite | |
| A pick | addressSearch.picked pickedFilled | Polite | |
| A pick with a map: when the view settles | map.addressShown | Polite | |
A pick that describePick rejects | describePick rejected | Polite | |
A pick, with describePick returning an announcement | addressSearch.picked | Polite |
The text in all five languages
Change the text#
For your whole app, pass messages to KvirnProvider. For one AddressSearch, pass its messages prop.
<KvirnProvider messages={{ addressSearch: { tooShort: '…' } }}>Warning: Don't forget
Announcements need a KvirnProvider around your app, outside any <form>, or an Announcer of your own. Without one nothing is announced, and a development warning says so.
What a screen reader reads#
| State or action | Read aloud | Politeness | Test |
|---|---|---|---|
| Focus on the field | combobox, Find an address, Type a street and number, …, has popup listbox, not expanded, autocomplete in list, 1 control, then button, Search | none | address-search.test.tsx › AddressSearch read aloud › focus: the field is read with its label, help text, privacy notice and state, then the Search button |
| Typing | nothing (the active suggestion is read through aria-activedescendant) | none | address-search.test.tsx › AddressSearch read aloud › typing says nothing, and no request is sent |
| Searching | polite: Searching for addresses | polite | address-search.test.tsx › AddressSearch read aloud › a slow search says it is searching |
| n results | polite: 2 addresses found, then option, Storgatan 1, 211 22 Malmö, not selected, position 1, set size 2 and the next | polite | address-search.test.tsx › AddressSearch read aloud › Search says the count, and the list is read as options |
| Too short | polite: Type at least 3 characters to search. | polite | address-search.test.tsx › AddressSearch read aloud › Search below minLength says what is missing |
| No results | polite: No address found for “nowhere”. Check the spelling, or add the town. | polite | address-search.test.tsx › AddressSearch read aloud › no address found says what to check |
| Error | polite: The address search isn’t working right now. Try again in a moment. | polite | address-search.test.tsx › AddressSearch read aloud › an error says to try again |
| Offline | polite: You’re offline. Connect to the internet, then search again. | polite | address-search.test.tsx › AddressSearch read aloud › offline says to connect and search again |
| Pick | polite: Chosen: <address label>. | polite | address-search.test.tsx › AddressSearch read aloud › a pick says which address was chosen |
| Pick with a map | polite: Chosen: <address label>., then polite: The map shows the address. 0 places. | polite | address-search.test.tsx › AddressSearch with a map › a pick with a map says which address was chosen, then that the map shows it |
| Pick rejected | polite: <the rejected text>, and the same words in the status line | polite | address-search.test.tsx › AddressSearch read aloud › a pick that describePick rejects says the rejected text instead of choosing |
| Pick with describePick | polite: <the announcement> in place of Chosen: … | polite | address-search.test.tsx › AddressSearch read aloud › a pick with describePick says its announcement in place of chosen |
| Clear | nothing | none | address-search.test.tsx › AddressSearch read aloud › Clear says nothing |
API reference#
Install the package. Import the theme once. The map’s styles are needed only when the search sits beside a map, and then MapLibre is needed too: see the Map page.
pnpm add @kvirn-ui/mapimport '@kvirn-ui/theme/theme.css'
// Only when the search sits beside a map:
import '@kvirn-ui/theme/map.css'Information: Implement like this
To change a text or add a class, build the field from its parts. AddressSearch is these parts in this order. Keep it: the input is described by the help text, then the notice.
<AddressSearch.Root geocoder={geocoder} onResult={onResult}>
<AddressSearch.Label>Find your address</AddressSearch.Label>
<AddressSearch.Control>
<AddressSearch.Input />
<AddressSearch.Clear />
<AddressSearch.Submit />
</AddressSearch.Control>
<AddressSearch.HelpText />
<AddressSearch.Notice />
<AddressSearch.Popup>
<AddressSearch.Status />
<AddressSearch.List>{(item) => <AddressSearch.Option item={item} />}</AddressSearch.List>
</AddressSearch.Popup>
</AddressSearch.Root>import { AddressSearch, useAddressSearch } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn' // or /nominatim, /google-placesAddressSearch
Renders The whole field, with the parts below in their default order: Label, Control (with Input, Clear and Submit), HelpText, Notice and Popup (with Status and List). It takes the props of AddressSearch.Root and label, and no children. On its own or beside a map, wrap it in a <search> element. Inside a form, leave <search> out.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | addressSearch.label | The visible label. Write it for the task, such as “Find your address”. It is the field’s name for a screen reader, so keep it visible. |
geocoder | GeocoderProvider | Required | The service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first. |
onResult | (result: AddressResult | null) => void | – | Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes. |
minLength | number | 3 | The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2. |
debounce | number | false | 400 | Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button. |
timeoutMilliseconds | number | 10000 | How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows. |
country | string | – | A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed. |
limitToCountry | boolean | false | With country: drops the results that have an address in another country, for a form that can’t record one. |
describePick | (result: AddressResult, messages) => { rejected: string } | { announcement: string } | – | Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text. |
initialText | string | – | The text the input starts with, for a field that already holds a value. |
disabled | boolean | false | Disables the field and the Search button. |
id | string | – | The id of the input. Without one the field makes its own. |
messages | Partial<KvirnMessages["addressSearch"]> | – | Changes the texts of this field only. See Strings below for every key and its English text. |
AddressSearch.Root
Renders A Field.Root, which is a <div class="kv-address-search">, that owns the search. Put the parts below inside it. It takes the props of Field.Root except messages, controlId and disabled, which the options below set. Also exported as AddressSearchRoot.
| Prop | Type | Default | Description |
|---|---|---|---|
geocoder | GeocoderProvider | Required | The service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first. |
onResult | (result: AddressResult | null) => void | – | Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes. |
minLength | number | 3 | The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2. |
debounce | number | false | 400 | Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button. |
timeoutMilliseconds | number | 10000 | How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows. |
country | string | – | A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed. |
limitToCountry | boolean | false | With country: drops the results that have an address in another country, for a form that can’t record one. |
describePick | (result: AddressResult, messages) => { rejected: string } | { announcement: string } | – | Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text. |
initialText | string | – | The text the input starts with, for a field that already holds a value. |
disabled | boolean | false | Disables the field and the Search button. |
id | string | – | The id of the input. Without one the field makes its own. |
messages | Partial<KvirnMessages["addressSearch"]> | – | Changes the texts of this field only. See Strings below for every key and its English text. |
| Class or attribute | Values | Meaning |
|---|---|---|
data-status | idle, too-short, searching, results, empty, error, offline, selected or rejected | What the search is doing, for your styles. A search that finds nothing is empty, not an error. rejected means describePick turned a pick down. |
AddressSearch.Label
Renders A <label for>, the visible name of the field. It takes the props of Field.Label. By default it shows no required or optional marker.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | addressSearch.label | The label text. Without children it shows the addressSearch.label text. |
AddressSearch.Control
Renders The box around the input, Clear and Submit. The popup is placed against it. It takes the props of Autocomplete.Control.
AddressSearch.Input
Renders An <input type="text"> with the role combobox, with browser autofill turned off. It takes the props of Autocomplete.Input. Enter with no suggestion chosen searches, and never sends a form.
AddressSearch.Clear
Renders A <button type="button" tabindex="-1">, so it is not a Tab stop. It empties the text, calls onResult(null) after a pick and keeps focus on the input. It takes the props of Autocomplete.Clear.
AddressSearch.Submit
Renders The Search button: a native <button type="button"> named by the addressSearch.submit text. It renders only when the search runs on request, and it never sends a form. It takes the attributes of a <button>. Its children replace the text “Search”.
AddressSearch.HelpText
Renders A <p>, the field’s help text. The input is described by it. It takes the props of Field.HelpText.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | the help text | The instruction under the field. Without children it says to press Search (on request) or to choose from the list (as you type). |
AddressSearch.Notice
Renders A <p> that says where the typed text goes, then shows the geocoder’s credit text. The input is described by it, after the help text, so a screen reader reads it when the field gets focus. It takes the props of Field.HelpText.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | the privacy notice | Without children it says where the typed text goes, with the geocoder’s name, then shows the geocoder’s attribution (its credit text). If you replace it, say both yourself. |
AddressSearch.Popup
Renders The popup that holds the status line and the list. It takes the props of Autocomplete.Popup.
AddressSearch.Status
Renders A <div> above the suggestions, in plain text with an icon: searching, too short, nothing found, error, offline or a pick turned down. It is not a live region. The same words are said through the Announcer, so they are not read twice. It renders nothing while the list is closed or there is no message.
| Class or attribute | Values | Meaning |
|---|---|---|
data-state | too-short, searching, empty, error, offline or rejected | Which message the line shows, for your styles. |
AddressSearch.List
Renders The listbox of suggestions, named by the label. It takes the props of Autocomplete.List.
| Prop | Type | Default | Description |
|---|---|---|---|
children | (item: AddressSuggestion) => ReactNode | – | Renders one AddressSearch.Option per address: (item) => <AddressSearch.Option item={item} />. The options show only while the list is open. |
AddressSearch.Option
Renders One suggestion, a <div role="option">. Its text is the geocoder’s label. It takes the props of Autocomplete.Option.
| Prop | Type | Default | Description |
|---|---|---|---|
item | AddressSuggestion | Required | One of the addresses the list hands you. |
children | ReactNode | the address label | The content of the option. Without children it shows the geocoder’s label, which is also what fills the field and what a screen reader reads. |
GeocoderProvider
Renders nothing: it is the object you pass in geocoder. KvirnUI names no service and has no default. To search your own register, write the object yourself: see the recipe under “Report a fault near an address”.
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | – | Who receives the typed text. It is named in the privacy notice, so write it as a person says it: “Kvirn’s map service”. Without a name the notice says “an address service”. |
attribution | string | – | The credit text that the service’s terms ask for. It is shown after the privacy notice. |
suggest | boolean | false | true only if the service’s terms allow a search at each pause in typing. Then the field searches as you type. Otherwise it searches on request. |
search | (query: string, options: { signal, locale, intent }) => Promise<AddressSuggestion[]> | Required | Finds addresses for the text. signal is cancelled when a new search starts, locale is the page’s language, and intent is "suggest" (a pause in typing) or "submit" (Enter or Search). Return a list; an empty list means nothing was found, and a rejected promise shows the error text. |
resolve | (suggestion, options: { signal, locale }) => Promise<AddressResult> | – | Adds the position to a suggestion that has none. It is called once, when the visitor picks. Without it, every suggestion needs a position in search, or picking it shows the error text. |
structured | (parts, options) => Promise<AddressResult | null> | – | Looks up an address whose parts are known. AddressInput uses it for a house number. AddressSearch does not call it. |
AddressResult
Renders nothing: it is the object onResult gets. A suggestion in the list has the same fields, and can leave out position when resolve adds it.
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | Required | A stable id, used as the option’s key. |
label | string | Required | The address as one line of text, with the town: “Drottninggatan 6, 111 51 Stockholm”. It is the option’s name, the text that fills the field and the address in the announcement after a pick. |
position | { longitude: number; latitude: number } | Required | Where the address is. |
bounds | { west, south, east, north } | – | The box around the place, for a street or an area. A map fits its view to it. |
address | { line1, postalCode, city, country } | – | The parts of a postal address, for filling in a form. country is a two-letter ISO 3166-1 code in upper case, such as SE. A result without it fills nothing in a form. |
precision | 'address' | 'street' | 'place' | – | How exact the result is: an address with a house number, a street without one, or a place such as a town. Left out when the service can’t tell. |
useAddressSearch
The state and props behind the field, for when you draw your own. It takes the same options as AddressSearch.Root and needs a KvirnProvider. It returns everything useAutocomplete returns (inputProps, popupProps, listProps, getOptionProps and the open state), plus the values below. The words in the result are the same texts as the parts show.
Options
| Prop | Type | Default | Description |
|---|---|---|---|
geocoder | GeocoderProvider | Required | The service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first. |
onResult | (result: AddressResult | null) => void | – | Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes. |
minLength | number | 3 | The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2. |
debounce | number | false | 400 | Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button. |
timeoutMilliseconds | number | 10000 | How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows. |
country | string | – | A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed. |
limitToCountry | boolean | false | With country: drops the results that have an address in another country, for a form that can’t record one. |
describePick | (result: AddressResult, messages) => { rejected: string } | { announcement: string } | – | Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text. |
initialText | string | – | The text the input starts with, for a field that already holds a value. |
disabled | boolean | false | Disables the field and the Search button. |
id | string | – | The id of the input. Without one the field makes its own. |
messages | Partial<KvirnMessages["addressSearch"]> | – | Changes the texts of this field only. See Strings below for every key and its English text. |
Result
| Prop | Type | Default | Description |
|---|---|---|---|
status | AddressSearchState | Required | What the search is doing: idle, too-short, searching, results, empty, error, offline, selected or rejected (describePick turned a pick down). |
results | readonly AddressSuggestion[] | Required | The latest answer. Earlier results stay listed while the next search runs. |
isOnRequest | boolean | Required | True when only Enter or the Search button sends a search. |
search | () => void | Required | Searches now, as Enter and Search do. |
submitProps | object | Required | Spread on the Search button. Show the button only while isOnRequest is true. It is a type="button" and never submits a form. |
statusProps | object | Required | Spread on the line above the suggestions. It carries data-state. |
statusText | string | undefined | Required | The words for the status line. There are none for idle, results and selected. |
labelText | string | Required | The default label text. |
helpText | string | Required | The default help text for the current mode. |
noticeText | string | Required | The default privacy notice text. |
attribution | string | undefined | Required | The geocoder’s credit text, to show after the notice. |
submitText | string | Required | The default text of the Search button. |
Strings
These are the default texts in @kvirn-ui/i18n.
For your whole app, pass messages to KvirnProvider. For one AddressSearch, pass its messages prop.
The texts exist in all five languages. Have a native speaker review the Swedish, Finnish and Norwegian ones before you launch. The geocoder’s name and the addresses it returns are yours, so write them in the page’s language.
addressSearch.label
The default label of the field.
| Language | Default text |
|---|---|
| Svenska | Hitta en adress |
| Suomi | Hae osoite |
| Norsk bokmål | Finn en adresse |
| Norsk nynorsk | Finn ei adresse |
| English | Find an address |
addressSearch.helpSuggest
The help text when the search runs as you type.
| Language | Default text |
|---|---|
| Svenska | Skriv minst 3 tecken av en gata, ett postnummer eller en ort. Välj sedan en adress i listan. |
| Suomi | Kirjoita vähintään 3 merkkiä kadusta, postinumerosta tai paikkakunnasta. Valitse sitten osoite luettelosta. |
| Norsk bokmål | Skriv minst 3 tegn av en gate, et postnummer eller et sted. Velg deretter en adresse fra listen. |
| Norsk nynorsk | Skriv minst 3 teikn av ein gate, eit postnummer eller ein stad. Vel deretter ei adresse frå lista. |
| English | Type at least 3 characters of a street, postal code or place. Then choose an address from the list. |
addressSearch.helpRequest
The help text when the search runs on request (Enter or Search).
| Language | Default text |
|---|---|
| Svenska | Skriv en gata och ett nummer, ett postnummer eller en ort. Tryck sedan på Sök. |
| Suomi | Kirjoita katu ja numero, postinumero tai paikkakunta. Paina sitten Hae. |
| Norsk bokmål | Skriv en gate og et nummer, et postnummer eller et sted. Trykk deretter på Søk. |
| Norsk nynorsk | Skriv ein gate og eit nummer, eit postnummer eller ein stad. Trykk deretter på Søk. |
| English | Type a street and number, a postal code or a place. Then press Search. |
addressSearch.submit
The name of the Search button, which shows only when the search runs on request.
| Language | Default text |
|---|---|
| Svenska | Sök |
| Suomi | Hae |
| Norsk bokmål | Søk |
| Norsk nynorsk | Søk |
| English | Search |
addressSearch.privacy
The notice that says where the typed text goes, with the name of the service.
| Language | Default text |
|---|---|
| Svenska | Det du skriver skickas till the Kvirn map service för att hitta adressen. |
| Suomi | Kirjoittamasi teksti lähetetään palveluun the Kvirn map service osoitteen hakemiseksi. |
| Norsk bokmål | Det du skriver, sendes til the Kvirn map service for å finne adressen. |
| Norsk nynorsk | Det du skriv, blir sendt til the Kvirn map service for å finne adressa. |
| English | What you type is sent to the Kvirn map service to find the address. |
addressSearch.privacyUnnamed
The notice when the geocoder has no name.
| Language | Default text |
|---|---|
| Svenska | Det du skriver skickas till en adresstjänst för att hitta adressen. |
| Suomi | Kirjoittamasi teksti lähetetään osoitepalveluun osoitteen hakemiseksi. |
| Norsk bokmål | Det du skriver, sendes til en adressetjeneste for å finne adressen. |
| Norsk nynorsk | Det du skriv, blir sendt til ei adresseteneste for å finne adressa. |
| English | What you type is sent to an address service to find the address. |
addressSearch.tooShort
Shown and announced when the search runs on request and the text is shorter than minLength.
| Language | Default text |
|---|---|
| Svenska | Skriv minst 3 tecken för att söka. |
| Suomi | Kirjoita vähintään 3 merkkiä hakeaksesi. |
| Norsk bokmål | Skriv minst 3 tegn for å søke. |
| Norsk nynorsk | Skriv minst 3 teikn for å søkje. |
| English | Type at least 3 characters to search. |
addressSearch.searching
Shown and announced when a request is on its way. It is left out when the answer is quick.
| Language | Default text |
|---|---|
| Svenska | Söker efter adresser |
| Suomi | Haetaan osoitteita |
| Norsk bokmål | Søker etter adresser |
| Norsk nynorsk | Søkjer etter adresser |
| English | Searching for addresses |
addressSearch.resultCount
Announced with the number of addresses found.
| Language | Default text |
|---|---|
| Svenska | 2 adresser hittades |
| Suomi | 2 osoitetta löytyi |
| Norsk bokmål | 2 adresser funnet |
| Norsk nynorsk | 2 adresser funne |
| English | 2 addresses found |
addressSearch.noResults
Shown and announced when nothing is found. It is not an error.
| Language | Default text |
|---|---|
| Svenska | Ingen adress hittades för ”Storgatn”. Kontrollera stavningen eller lägg till orten. |
| Suomi | Osoitetta ”Storgatn” ei löytynyt. Tarkista kirjoitusasu tai lisää paikkakunta. |
| Norsk bokmål | Fant ingen adresse for «Storgatn». Sjekk stavemåten, eller legg til stedet. |
| Norsk nynorsk | Fann inga adresse for «Storgatn». Sjekk stavemåten, eller legg til staden. |
| English | No address found for “Storgatn”. Check the spelling, or add the town. |
addressSearch.error
Shown and announced when the search fails or takes too long.
| Language | Default text |
|---|---|
| Svenska | Adresssökningen fungerar inte just nu. Försök igen om en stund. |
| Suomi | Osoitehaku ei toimi juuri nyt. Yritä hetken kuluttua uudelleen. |
| Norsk bokmål | Adressesøket fungerer ikke akkurat nå. Prøv igjen om litt. |
| Norsk nynorsk | Adressesøket fungerer ikkje akkurat no. Prøv igjen om litt. |
| English | The address search isn’t working right now. Try again in a moment. |
addressSearch.offline
Shown and announced when the visitor is offline. No request is sent.
| Language | Default text |
|---|---|
| Svenska | Du är offline. Anslut till internet och sök igen. |
| Suomi | Olet offline-tilassa. Yhdistä internetiin ja hae uudelleen. |
| Norsk bokmål | Du er frakoblet. Koble til internett og søk på nytt. |
| Norsk nynorsk | Du er fråkopla. Kopl til internett og søk på nytt. |
| English | You’re offline. Connect to the internet, then search again. |
addressSearch.picked
Announced after a pick.
| Language | Default text |
|---|---|
| Svenska | Vald: Drottninggatan 6, 111 51 Stockholm. |
| Suomi | Valittu: Drottninggatan 6, 111 51 Stockholm. |
| Norsk bokmål | Valgt: Drottninggatan 6, 111 51 Stockholm. |
| Norsk nynorsk | Vald: Drottninggatan 6, 111 51 Stockholm. |
| English | Chosen: Drottninggatan 6, 111 51 Stockholm. |
addressSearch.pickedFilled
Announced after a pick when the result fills in a form. Pass it as picked, for one field.
| Language | Default text |
|---|---|
| Svenska | Vald: Drottninggatan 6, 111 51 Stockholm. Adressen är ifylld nedan. Kontrollera den innan du fortsätter. |
| Suomi | Valittu: Drottninggatan 6, 111 51 Stockholm. Osoite on täytetty alle. Tarkista se ennen kuin jatkat. |
| Norsk bokmål | Valgt: Drottninggatan 6, 111 51 Stockholm. Adressen er fylt ut nedenfor. Sjekk den før du fortsetter. |
| Norsk nynorsk | Vald: Drottninggatan 6, 111 51 Stockholm. Adressa er fylt ut nedanfor. Sjekk ho før du held fram. |
| English | Chosen: Drottninggatan 6, 111 51 Stockholm. The address is filled in below. Check it before you continue. |
These are the default texts in @kvirn-ui/i18n.
This text belongs to the Map. It is said when a pick moves the map beside the field, and messages on Map.Root or the provider replaces it.
map.addressShown
Announced when the map has moved to the picked address. The places in view follow it.
| Language | Default text |
|---|---|
| Svenska | Kartan visar adressen. |
| Suomi | Kartta näyttää osoitteen. |
| Norsk bokmål | Kartet viser adressen. |
| Norsk nynorsk | Kartet viser adressa. |
| English | The map shows the address. |
Known issues#
- Review the translations before you launch. Have a native speaker review the Swedish, Finnish, Norwegian Bokmål and Norwegian Nynorsk texts.
- "Chosen" may be heard twice. Some screen readers also read the new value of the field. Check it with your users' assistive technology.
- Test with your users and their assistive technology.
Information: Did you know?
If an issue here affects your service, list it in your accessibility statement with its workaround.
Testing#
The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.
| AT + browser + OS | Agent check | Human check | Result | Notes |
|---|---|---|---|---|
| Automated (re-runnable tests) | ||||
| axe, WCAG 2.2 A and AA, every story, 4 themes | pass | n/a | pass | address-search.stories.tsx, every story except LiveWithMap (it calls the network), 4 themes |
| Markup and ARIA (roles, names, ids, states) | pass | n/a | pass | 2026-10-24: address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice, and › AddressSearch read aloud (role, name and state per phrase); address-search.stories.tsx axe, 4 themes |
| Keyboard contract rows (Vitest browser) | pass | n/a | pass | every row names a test in address-search.test.tsx or autocomplete.test.tsx |
| Focus order and management | pass | n/a | pass | address-search.test.tsx asserts focus (toHaveFocus) after Tab, a pick, Clear and a map move: pick with Enter: the text becomes the label, onResult is called once, focus stays and picked is announced |
| Display modes (forced colours, 320px reflow, text spacing, reduced motion) | pass | n/a | pass | address-search.stories.tsx in the four sweep projects (map is in sweepComponents, vite.config.ts), all four re-run 2026-10-23 on the final theme.css, green |
| Core (required for beta) | ||||
| NVDA + Chrome + Windows | pass | pending | pending | agent 2026-10-24: address-search.test.tsx › AddressSearch read aloud and › AddressSearch with a map (readAloud, readAnnouncements), every Keyboard row test, the four sweeps (Chromium) |
| VoiceOver + Safari + iOS | pending | pending | pending | |
| Release (before 1.0 and each minor) | ||||
| JAWS + Chrome + Windows | pending | pending | pending | |
| TalkBack + Chrome + Android | pending | pending | pending | |
| VoiceOver + Safari + macOS | pending | pending | pending |
What to check#
- Tab to the field. A screen reader reads the label, the help text and where the typed text goes. On request, one more Tab reaches the Search button. Clear is not a Tab stop.
- Type a few characters, then press Enter or Search. A message may say that the search is running, and then says how many addresses were found. Typing alone sends nothing on request.
- Press ArrowDown to move through the list: each address is read. Press Enter to choose one. The address fills the field, focus stays in the field and "Chosen" is heard.
- Search for text that matches nothing, for fewer characters than the minimum, and with the network off. Each gives a message that says what to do next.
- In a form, press Enter in the search: it searches and the form is not sent. After a pick the address boxes are filled in and can still be edited.
- Beside a map, choose an address. The map moves and shows a pin, and "The map shows the address" is heard once the map settles. Focus stays in the field.