Skip to content

fix(search-box-by-type): Revert clear button focus fix

Nathan Friend requested to merge nfriend-revert-search-box-clear-button-fix into master

What does this MR do?

Reverts the change made in !1521 (merged).

Why?

This change caused issues with some Jest tests when integrated with gitlab-org/gitlab. For example: https://gitlab.com/gitlab-org/gitlab/-/pipelines/160348806

[Vue warn]: Error in nextTick: "Error: Unexpected call of console.warn() with:
    [BootstrapVue warn]: tooltip - Unable to find target element in document."
    found in
    ---> <BVTooltip>
           <GlClearIconButton>
             <GlSearchBoxByType>
               <GlPaginatedList>
                 <Anonymous>
                   <Root>
      at warn (node_modules/vue/dist/vue.runtime.common.dev.js:621:15)
      at logError (node_modules/vue/dist/vue.runtime.common.dev.js:1880:5)
      at globalHandleError (node_modules/vue/dist/vue.runtime.common.dev.js:1875:3)
      at handleError (node_modules/vue/dist/vue.runtime.common.dev.js:1835:5)
      at Array.<anonymous> (node_modules/vue/dist/vue.runtime.common.dev.js:1978:9)
      at flushCallbacks (node_modules/vue/dist/vue.runtime.common.dev.js:1902:14)

This has something to do with the fact that the clear button that was modified in !1521 (merged) uses a BVTooltip internally, and its behavior depends on the button being visible at the time of instantiation. !1521 (merged) updated this button to be hidden using v-show instead of v-if, which affects when and how this element is instantiated.

A fix similar to !1521 (merged) will be submitted once a solution is found that doesn't break gitlab's Jest tests.

Merge request reports