Skip to content

Commit

Permalink
Select Improver: Remove inital flashing of old select (#1917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterjun3 authored Jul 13, 2024
1 parent d3c5e78 commit 8887c87
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions TASVideos/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
</script>
}
<script condition="ViewData.UsesSelectImprover()" src="/js/select-improver.js"></script>
<noscript condition="ViewData.UsesSelectImprover()"><style>.d-none-except-noscript { display: block !important; }</style></noscript>
<script condition="ViewData.UsesUserSearch()" src="/js/user-search.js"></script>
<script condition="ViewData.UsesBackupText()" src="/js/backup-text.js"></script>
<script condition="ViewData.UsesStringList()" src="/js/string-list.js"></script>
Expand Down
1 change: 1 addition & 0 deletions TASVideos/TagHelpers/Attributes/MultiSelectTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
if (Multiselect)
{
output.Attributes.Add("data-multiselect", "true");
output.AddCssClass("d-none-except-noscript");
ViewContext.ViewData.UseSelectImprover();
}
}
Expand Down
4 changes: 4 additions & 0 deletions TASVideos/wwwroot/css/partials/_customizations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -716,4 +716,8 @@ top-button-bar {
padding: 0.5em;
}
}
}

.d-none-except-noscript {
display: none !important;
}
1 change: 0 additions & 1 deletion TASVideos/wwwroot/js/select-improver.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ function engageSelectImprover(multiSelectId, maxHeight = 250) {
</div>
`;
let multiSelect = document.getElementById(multiSelectId);
multiSelect.classList.add('d-none');
let div = document.getElementById(multiSelectId + '_div');
div?.remove();
multiSelect.insertAdjacentHTML('afterend', initialHtmlToAdd);
Expand Down

0 comments on commit 8887c87

Please sign in to comment.