Skip to content

Fix responsive highlight width#26973

Merged
mdo merged 1 commit intotwbs:v4-devfrom
MartijnCuppens:patch-2
Jul 29, 2018
Merged

Fix responsive highlight width#26973
mdo merged 1 commit intotwbs:v4-devfrom
MartijnCuppens:patch-2

Conversation

@MartijnCuppens
Copy link
Copy Markdown
Member

Closes #26972

@mdo
Copy link
Copy Markdown
Member

mdo commented Jul 29, 2018

Ah, this had been bugging me for awhile and I never actually dug in.

@mdo mdo merged commit 774724a into twbs:v4-dev Jul 29, 2018
@mdo mdo mentioned this pull request Jul 29, 2018
@MartijnCuppens MartijnCuppens deleted the patch-2 branch July 30, 2018 06:36
@MartijnCuppens
Copy link
Copy Markdown
Member Author

The DOM of the autocomplete gets removed every time the search field loses focus. This made it a bit harder to debug this. I made this function which stores the autocomplete content in a variable and adds it back to the DOM if the autocomplete is cleared:

function debugSearch(){
  var target = document.querySelector('.ds-dataset-1');
  var observer = new MutationObserver(function(mutations) {
    if (target.innerHTML !== ''){
      window.serachHtml = target.innerHTML;
    }
    else {
      target.innerHTML = window.serachHtml;
      target.parentNode.style.display = 'block';
    }
  });
  observer.observe(target, {childList: true});
}

This might come in handy next time if you want to debug the search autocomplete (There are probably better solutions, but this did the trick for me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants