Skip to content
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

Prevent select element from flashing right before it's replaced #1782

Closed
wants to merge 1 commit into from

Conversation

Masterjun3
Copy link
Collaborator

Look at this code, this feels very hacky.

@@ -27,6 +27,7 @@
<link rel="alternate" href="/publications.rss" type="application/rss+xml" title="TASVideos RSS Publication Feed">
<link rel="alternate" href="/wiki.rss" type="application/rss+xml" title="TASVideos RSS Wiki Feed">
<partial name="_MetaTags" />
<script>document.head.appendChild(document.createElement("style")).innerHTML = '.d-none-js { display: none !important; }';</script>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively:

Suggested change
<script>document.head.appendChild(document.createElement("style")).innerHTML = '.d-none-js { display: none !important; }';</script>
<!-- can move to main stylesheet --><style>:root.supports-js .d-none-js { display: none !important; }</style>
<script>document.documentElement.classList.add("supports-js");</script>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(I can't test right now) Have you tested whether that prevents the flashing on repeated reloading on the usual browsers on desktop and mobile?
It may look the same, but I noticed adding a <style> blocks cached rendering better than adding a css class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't (I also can't test atm)

Copy link
Collaborator

Choose a reason for hiding this comment

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

they are all a single taghelper now if that helps with a better strategy. But can we close this? we dont' want this hacky approach

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I'm going to close this PR. This seems to need a different approach altogether.

@adelikat
Copy link
Collaborator

adelikat commented Mar 6, 2024

I'm not sure i want this PR

@Masterjun3 Masterjun3 marked this pull request as draft March 6, 2024 17:09
@Masterjun3
Copy link
Collaborator Author

I'm converting this to a draft, I want to try out the suggested thing and some other stuff. If I can't find anything, I'll just close this.

@Masterjun3
Copy link
Collaborator Author

Closing because we need a different approach altogether.

@Masterjun3 Masterjun3 closed this Jul 12, 2024
@Masterjun3 Masterjun3 deleted the prevent-select-flashing branch July 18, 2024 18:19
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.

None yet

3 participants