-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove jQuery from user notes preview #529
base: trunk
Are you sure you want to change the base?
Remove jQuery from user notes preview #529
Conversation
} ); | ||
// Make first child of the preview focusable. | ||
if ( preview.firstChild ) { | ||
preview.firstChild.setAttribute( 'tabindex', '0' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks like a place for firstElementChild
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6762ec8
It's weird I didn't get the error until now 🤔
spinner = document.createElement( 'span' ); | ||
spinner.className = 'spinner'; | ||
spinner.style.display = 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does create the spinner correctly, but apparently it was never styled when we moved to the block theme, so nothing is visible. Not a problem for this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where can I check the old styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't copy over the old styles, but you could borrow the loading animation from this CSS (it's the loading state for images such as the pattern & style variation screenshots on Themes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spinner didn't have any styled, an empty span was appearing. I added the style, but the time of the spinner is quite small.
What
Remove jQuery from
user-notes-preview.js
Why
jQuery is known to inflate the bundle size of packages, and in most cases, it can be replaced with native language functionality.