Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML attributes API: configure the addon via HTML attributes #56

Merged
merged 3 commits into from
Apr 19, 2023

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 19, 2023

By default the search modal is shown when pressing /. However, we want this to be configurable by the user. This can be achieved by passing show-modal-keycode attribute to the web component as follows:

<readthedocs-search show-modal-keycode="220">
</readthedocs-search>

In this case, it will be shown when pressing \.

I think this is a good pattern for static values that won't be changed from the dashboard or similar in a dynamic way.

Related #13

By default the search modal is shown when pressing `/`.
However, we want this to be configurable by the user.
This can be achieved by passing `show-modal-keycode` attribute to the web
component as follows:

```html
<readthedocs-search show-modal-keycode="220">
</readthedocs-search>
```

In this case, it will be shown when pressing `\`.

I think this is a good pattern for static values that won't be changed from the
dashboard or similar in a dynamic way.

Related #13
@humitos humitos requested a review from a team as a code owner April 19, 2023 17:59
@humitos humitos requested a review from agjohnson April 19, 2023 17:59
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was thinking for a first pass too, this patterns seems like a good fit for us 👍

src/search.js Outdated Show resolved Hide resolved
@humitos
Copy link
Member Author

humitos commented Apr 19, 2023

Thanks for the feedback. I updated the code to use Lit properties.

@humitos humitos merged commit 1748c75 into main Apr 19, 2023
@humitos humitos deleted the humitos/api-html-attributes branch April 19, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants