{"record":{"id":"18151580a820539f","repo":"sveltejs/kit","slug":"data-sveltekit-name-true-has-been-replaced","errorCode":null,"errorMessage":"`data-sveltekit-${name}=\"true\"` has been replaced with `data-sveltekit-reset=\"false\"`","messagePattern":"`data-sveltekit-(.+?)=\"true\"` has been replaced with `data-sveltekit-reset=\"false\"`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/utils.js","lineNumber":181,"sourceCode":"\t/** @type {ValidLinkOptions<'reload'> | null} */\n\tlet reload = null;\n\n\t/** @type {ValidLinkOptions<'replacestate'> | null} */\n\tlet replace_state = null;\n\n\t/** @type {ValidLinkOptions<'reset'> | null} */\n\tlet reset = null;\n\n\t/** @type {Element} */\n\tlet el = element;\n\n\twhile (el && el !== document.documentElement) {\n\t\tif (DEV) {\n\t\t\tfor (const name of ['keepfocus', 'noscroll']) {\n\t\t\t\tconst value = el.getAttribute(`data-sveltekit-${name}`);\n\t\t\t\tif (value !== null && !warned.has(el)) {\n\t\t\t\t\twarned.add(el);\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`\\`data-sveltekit-${name}=\"true\"\\` has been replaced with \\`data-sveltekit-reset=\"false\"\\``\n\t\t\t\t\t);\n\t\t\t\t\tconsole.log(el);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (preload_code === null) preload_code = link_option(el, 'preload-code');\n\t\tif (preload_data === null) preload_data = link_option(el, 'preload-data');\n\t\tif (reload === null) reload = link_option(el, 'reload');\n\t\tif (replace_state === null) replace_state = link_option(el, 'replacestate');\n\t\tif (reset === null) reset = link_option(el, 'reset');\n\n\t\tel = /** @type {Element} */ (parent_element(el));\n\t}\n\n\t/** @param {string | null} value */\n\tfunction get_option_state(value) {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/utils.js#L163-L199","documentation":"SvelteKit replaced the `data-sveltekit-keepfocus` and `data-sveltekit-noscroll` attributes with a single `data-sveltekit-reset=\"false\"` attribute that keeps focus and prevents scrolling on navigation. When resolving router options from the DOM in DEV, `get_router_options` warns (once per element) if it finds any of the legacy attributes, telling you the replacement. The legacy attributes are ignored.","triggerScenarios":"An element in the component tree (walked up from a link to `document.documentElement`) has `data-sveltekit-keepfocus=\"true\"` or `data-sveltekit-noscroll=\"true\"`, and a navigation resolves router options through that element in DEV.","commonSituations":"Apps migrated from older SvelteKit versions whose `<a>` tags or layouts still carry keepfocus/noscroll attributes; copied snippets from old tutorials or documentation.","solutions":["Remove `data-sveltekit-keepfocus=\"true\"` and `data-sveltekit-noscroll=\"true\"` from your elements/layouts","Add `data-sveltekit-reset=\"false\"` where the old keepfocus/noscroll behavior is wanted","Search the codebase: `grep -r 'data-sveltekit-keepfocus\\|data-sveltekit-noscroll'`"],"exampleFix":"<!-- before -->\n<a href=\"/search\" data-sveltekit-noscroll=\"true\" data-sveltekit-keepfocus=\"true\">Search</a>\n<!-- after -->\n<a href=\"/search\" data-sveltekit-reset=\"false\">Search</a>","handlingStrategy":"validation","validationCode":"if (document.querySelector('[data-sveltekit-keepfocus],[data-sveltekit-noscroll]')) console.warn('legacy data-sveltekit attributes found — use data-sveltekit-reset=\"false\"');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Replace keepfocus/noscroll attributes with data-sveltekit-reset=\"false\"","Add an eslint-plugin-svelte or HTML lint rule against legacy attributes","Re-check templates after SvelteKit major upgrades"],"tags":["deprecation","attributes","routing","accessibility","sveltekit"],"backgroundTag":"deprecated-html-attribute","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}