sveltejs / sveltejs/kit

Option to disable or configure `svelte-announcer`

Open
#12,661 5 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

Currently, the svelte-announcer element always gets injected into the webpage, and there is no way to disable it or override its behavior.

Describe the proposed solution

It would be nice to be able to disable it or control it in some form, for example if we wish to have more fine-grained ARIA announcements.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

For anyone currently looking to remove svelte-announcer and implement their own, we use this preprocessor as a workaround to get rid of it in svelte.config.js:

    preprocess: [
        {
            name: "strip-announcer",
            markup: ({ content: code }) => {
                code = code.replace(
                    /<div id="svelte-announcer" [\s\S]*?<\/div>/,
                    '<svelte:component this={null} />'
                );

                return { code }
            }
        },
        // ...
    ],
    // ...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the svelte.config.js workaround and tracing where the svelte-announcer element is injected. Define whether the configuration should disable the announcer, replace it, or expose behavior controls, then verify that custom ARIA announcements remain possible without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.