Skip to content

fix: InlineLoading changes browser title to not loading due to missing svg #19469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mihui
Copy link

@mihui mihui commented May 22, 2025

Closes #19467

Fixed the changed title of the tab when the status is set to inactive

Changelog

New

  • N/A

Changed

  • Added the svg tag to wrap the title tag in order to fix the changes to the tab's title

Removed

  • N/A

Testing / Reviewing

  1. Use the URL mentioned in the issue [Bug]: InlineLoading makes brower title as "not loading" when it is set to "inactive" #19467 to test the result and see if the browser's title is changed
    https://gqairvnmmrgithub-aszi--5173--4d9fd228.local-corp.webcontainer.io/
  2. Click on the button to toggle the InlineLoading status
  3. Check the tab's title

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@mihui mihui requested review from a team as code owners May 22, 2025 17:06
@mihui mihui requested review from 2nikhiltom and annawen1 May 22, 2025 17:06
Copy link
Contributor

github-actions bot commented May 22, 2025

All contributors have signed the DCO.
Posted by the DCO Assistant Lite bot.

Copy link

netlify bot commented May 22, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit a198594
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/682f597d4571a700081fc293
😎 Deploy Preview https://deploy-preview-19469--v11-carbon-web-components.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.

@mihui
Copy link
Author

mihui commented May 23, 2025

I have read the DCO document and I hereby sign the DCO.

Comment on lines +137 to +141
<svg width="0" height="0" viewBox="0 0 0 0">
<title className={`${prefix}--inline-loading__inactive-status`}>
{iconLabel}
</title>
</svg>
Copy link
Contributor

@adamalston adamalston May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to use a custom svg here that's effectively blank? Are there any accessibility implications related to the latter?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not effect the title element in the page that can cause page title change, it is essential to surround the svg to indicate it is title of SVG element, also it is consistent with the other spinning icons, you'll know when you change the status of the InlineLoading component.

if (status === 'error') {
return (
element = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #19467, if the issue only affects the inactive status, why modify the handling for all other statuses? Is the issue more pervasive than reported?

Copy link
Author

@mihui mihui May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All others are in the animation wrapper, which "inactive" does not necessarily have an animation wrapper, to do so I had two options: 1) Not to change this return statement, but I have to additionally add another "if" to determine if it is not "inactive"; 2) change the whole piece of code to save 1 more logic check for only "inactive" status. So you can see in loading.animation = (<svg...</svg>) removes <div className={`${prefix}--inline-loading__animation`}>{loading}</div> wrapper for inactive loading animation.

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

Successfully merging this pull request may close these issues.

[Bug]: InlineLoading makes brower title as "not loading" when it is set to "inactive"
3 participants