Skip to content

Search plugin: replace image and use button tag #528

Closed
@jhildenbiddle

Description

@jhildenbiddle

The search plugin would benefit from two minor updates:

  1. Swap the close button <svg> for one that is properly sized to avoid sizing via CSS transform.

https://github.com/QingWei-Li/docsify/blob/6c7ebc989dd1572f744fbe5fc8f5af710b790cce/src/plugins/search/component.js#L56-L58

https://github.com/QingWei-Li/docsify/blob/6c7ebc989dd1572f744fbe5fc8f5af710b790cce/src/plugins/search/component.js#L99-L103

  1. Use a <button> element for the close button to allow the element to receive focus. Another option is to add tabindex="0" to the clear button div, but a button tag is the correct tag for this scenario. The <button> tag should also contain an aria-label for screen readers since it does not contain a text label:

    <button class="clear-button show" aria-label="Clear search">...</button>

https://github.com/QingWei-Li/docsify/blob/6c7ebc989dd1572f744fbe5fc8f5af710b790cce/src/plugins/search/component.js#L98

These two changes have been integrated into docsify-themeable via a plugin. It is preferable to have these changes integrated directly into docsify.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions