Create re-usable method to hide flash

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussion from !18898 (closed) should be addressed:

Possible solutions per @blabuschagne

Something like:

const hideFlashBySelector = querySelector => {
  const flashElement = document.querySelector(querySelector);

  if (!flashElement) return;

  hideFlash(flashElement);
};

Else we could make use of .flash-content as the querySelector as this is setup during createFlashEl and we expect it to exist when there's a flash. If we decide to do this we could then simply make the following change to hideFlash;

const hideFlash = (flashEl, fadeTransition = true) => {
  const element = flashEl || document.querySelector('.flash-content');
  if (!element) return;

  //update refs from flashEl to element
  ...

I prefer the second approach as it's the behaviour I originally expected and there is less of a footprint. Additional I'd suggest doing this entire update in a follow-up issue as there are specs which will need to be updated and we should be able to knock it all out in a single MR.

Edited by 🤖 GitLab Bot 🤖