Skip to main content

SpokenPhraseMatcher

Spoken phrase matcher for the screen reader navigate until operations.

For example:

import { voiceOver } from "@guidepup/guidepup";

(async () => {
// Start VoiceOver.
await voiceOver.start();

// Navigate to the next location until fully matching "Links, heading level 2".
await voiceOver.navigateNextHeadingUntil("Links, heading level 2");

// Navigate to the next link until partial matching "Home".
await voiceOver.navigateNextLinkUntil(/Home/);

// Navigate to the next location until the callback function returns true.
await voiceOver.navigateNextUntil((spokenPhrase) =>
spokenPhrase.includes("Submit"),
);

// Stop VoiceOver.
await voiceOver.stop();
})();

Contents:

spokenPhraseMatcher​

A spoken phrase matcher can be an exact matching string, a regular expression, or a function that returns whether the spoken phrase matches.

Type: string | RegExp | (spokenPhrase: string) => boolean