Skip to content

fix(core): render base URL suggestion as text (AI-assisted)#12220

Open
ishaanlabs-gg wants to merge 1 commit into
facebook:mainfrom
ishaanlabs-gg:fix-base-url-banner-text-content
Open

fix(core): render base URL suggestion as text (AI-assisted)#12220
ishaanlabs-gg wants to merge 1 commit into
facebook:mainfrom
ishaanlabs-gg:fix-base-url-banner-text-content

Conversation

@ishaanlabs-gg

@ishaanlabs-gg ishaanlabs-gg commented Jul 2, 2026

Copy link
Copy Markdown

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • This is not a new API or substantial change.

Motivation

(AI-assisted)

Closes #12216.

The base URL issue banner currently writes the suggested baseUrl with innerHTML, even though the value is intended to be displayed as plain text from window.location.pathname.

Using textContent keeps the rendered output the same for normal paths while avoiding an unnecessary HTML sink in the inline banner script.

Test Plan

(AI-assisted)

  • Added a regression test that checks the suggested baseUrl assignment uses textContent and does not use innerHTML.
  • Verified the source and regression test with a focused Node check.
  • git diff --check HEAD~1 HEAD -- packages/docusaurus/src/client/BaseUrlIssueBanner/index.tsx packages/docusaurus/src/client/__tests__/BaseUrlIssueBanner.test.ts
  • npm exec --yes --package oxfmt@0.47.0 --call "oxfmt --check packages/docusaurus/src/client/BaseUrlIssueBanner/index.tsx packages/docusaurus/src/client/__tests__/BaseUrlIssueBanner.test.ts"

Test links

Deploy preview: https://deploy-preview-12220--docusaurus-2.netlify.app/

Related issues/PRs

Closes #12216.

@meta-cla

meta-cla Bot commented Jul 2, 2026

Copy link
Copy Markdown

Hi @ishaanlabs-gg!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 4b52c43
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a46ac3a21e373000889a52b
😎 Deploy Preview https://deploy-preview-12220--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): use textContent instead of innerHTML for pathname display in BaseUrlIssueBanner

1 participant