You have an extra single quote after `href='#'` and this extra quote is causing it to be an invalid element. This is why focus gets lost after using the close button.