Skip to content

Commit

Permalink
Fix clear button flickering on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Sep 9, 2024
1 parent f4f7ec4 commit 06ca3d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/components/primer/open_project/sub_header.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@
width: 100%;
gap: 8px;
}

.SubHeader-filterInput_hiddenClearButton + button.FormControl-input-trailingAction {
display: none;
}
2 changes: 1 addition & 1 deletion app/components/primer/open_project/sub_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SubHeader < Primer::Component
renders_one :filter_input, lambda { |name:, label:, **system_arguments|
system_arguments[:classes] = class_names(
system_arguments[:classes],
"SubHeader-filterInput"
"SubHeader-filterInput SubHeader-filterInput_hiddenClearButton"
)
system_arguments[:placeholder] ||= I18n.t("button_filter")
system_arguments[:leading_visual] ||= { icon: :search }
Expand Down
1 change: 1 addition & 0 deletions app/components/primer/open_project/sub_header_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SubHeaderElement extends HTMLElement {
this.waitForCondition(
() => Boolean(this.filterInput),
() => {
this.filterInput.classList.remove('SubHeader-filterInput_hiddenClearButton')
this.clearFilterButton = this.querySelector('button.FormControl-input-trailingAction') as HTMLButtonElement

if (this.clearFilterButton) {
Expand Down

0 comments on commit 06ca3d9

Please sign in to comment.