Skip to content

[fix] News Site Nuxt: rename 'className' -> 'class'#400

Merged
flashdesignory merged 2 commits intoWebKit:mainfrom
flashdesignory:fix/news-site-nuxt
Mar 22, 2024
Merged

[fix] News Site Nuxt: rename 'className' -> 'class'#400
flashdesignory merged 2 commits intoWebKit:mainfrom
flashdesignory:fix/news-site-nuxt

Conversation

@flashdesignory
Copy link
Copy Markdown
Contributor

@flashdesignory flashdesignory commented Mar 14, 2024

Two instances, where className instead of class was used.
This happened in areas that tests don't cover and shouldn't impact score.

More details:
on small screens the news site hides the navbar and displays a hamburger icon.
This hamburger icon had some missing class assignments due to the oversight.
Since we don't test mobile view, this is not an issue in the current tests.

@kara

@flashdesignory flashdesignory changed the title [fix] News Site Next: rename 'className' -> 'class' [fix] News Site Nuxt: rename 'className' -> 'class' Mar 14, 2024
@rniwa
Copy link
Copy Markdown
Member

rniwa commented Mar 14, 2024

It's good to fix this for the next version but I don't think we should merge this back into 3.0 at this point.

@flashdesignory
Copy link
Copy Markdown
Contributor Author

It's good to fix this for the next version but I don't think we should merge this back into 3.0 at this point.

yeah, no need to merge into 3.0.

<input :id="navbarStyles['navbar-toggle']" type="checkbox" :checked="isOpen" @change="handleChange" />
<label :for="navbarStyles['navbar-toggle']" :class="navbarStyles['navbar-label']">
<span className="visually-hidden">Navbar Toggle</span>
<span class="visually-hidden">Navbar Toggle</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was that used somewhere? It's not clear to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, it would only be seen if it's rendered on mobile view, but Speedometer uses a larger viewport.
This is just being a "good citizen" and fixing stuff 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TBH I think this changes nothing. I looked at the dist in https://browserbench.org/Speedometer3.0/resources/newssite/news-nuxt/dist/ and I found we properly have class attributes:
image

(I used Firefox' responsive mode)

It looks like Vue accepts className just as well as class.

Copy link
Copy Markdown
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

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

I'm surprised that for a patch that should change nothing there are so many things changed in the rendered files. Can you check why this happens?
Also it looks like some dist files were removed by mistake...

Comment thread resources/newssite/news-nuxt/dist/index.html
Comment thread resources/newssite/news-nuxt/dist/404.html
<input :id="navbarStyles['navbar-toggle']" type="checkbox" :checked="isOpen" @change="handleChange" />
<label :for="navbarStyles['navbar-toggle']" :class="navbarStyles['navbar-label']">
<span className="visually-hidden">Navbar Toggle</span>
<span class="visually-hidden">Navbar Toggle</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TBH I think this changes nothing. I looked at the dist in https://browserbench.org/Speedometer3.0/resources/newssite/news-nuxt/dist/ and I found we properly have class attributes:
image

(I used Firefox' responsive mode)

It looks like Vue accepts className just as well as class.

@flashdesignory
Copy link
Copy Markdown
Contributor Author

I'm surprised that for a patch that should change nothing there are so many things changed in the rendered files. Can you check why this happens?
Also it looks like some dist files were removed by mistake...

Oh you're so right 🤦 ....
To create static files, we need to use the generate script and not the build script.
It's confusing and we should probably change that at some point..

@flashdesignory
Copy link
Copy Markdown
Contributor Author

@julienw - regarding className vs class: this is more a change to be consistent. I don't think it's ideal to use both in the same codebase. You're right that it doesn't change the behavior, it's really just clean-up!

@julienw
Copy link
Copy Markdown
Contributor

julienw commented Mar 22, 2024

@julienw - regarding className vs class: this is more a change to be consistent. I don't think it's ideal to use both in the same codebase. You're right that it doesn't change the behavior, it's really just clean-up!

Thanks for confirming; I don't mind doing cleanup, but your PR description was mentioning class assignments were missing, so I was curious if I missed anything here.

I'm still surprised that there are so much changes in the generated files despite the change doing nothing... It would be good that we can make this more predictable eventually...

@flashdesignory
Copy link
Copy Markdown
Contributor Author

I'm still surprised that there are so much changes in the generated files despite the change doing nothing... It would be good that we can make this more predictable eventually...

yeah, nuxt generates a new hash that's being used in the filename... I'll look into it separately.

@flashdesignory flashdesignory merged commit 13cc928 into WebKit:main Mar 22, 2024
@flashdesignory flashdesignory deleted the fix/news-site-nuxt branch March 22, 2024 16:21
@julienw
Copy link
Copy Markdown
Contributor

julienw commented Mar 22, 2024

yeah, nuxt generates a new hash that's being used in the filename... I'll look into it separately.

It's not just the hash, if you look at the content of the files, the minified variable names are also different... that's so weird.

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.

3 participants