Fixed capturing of keyboard events for custom elements

Co-authored-by: vtsvetkov-splunk <142901247+vtsvetkov-splunk@users.noreply.github.com>
This commit is contained in:
squidfunk 2024-01-24 10:38:32 +07:00
parent 6128ab92f2
commit be95f4901a
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
9 changed files with 20 additions and 18 deletions

View File

@ -23,5 +23,5 @@
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ 'assets/javascripts/custom.054acff4.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/custom.526c59dc.min.js' | url }}"></script>
{% endblock %}

View File

@ -218,7 +218,7 @@
"base": base_url,
"features": features,
"translations": {},
"search": "assets/javascripts/workers/search.c011b7c0.min.js" | url
"search": "assets/javascripts/workers/search.b8dbb3d2.min.js" | url
} -%}
{%- if config.extra.version -%}
{%- set mike = config.plugins.get("mike") -%}
@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.7f914c06.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.a963951d.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -114,7 +114,9 @@ export function getOptionalElement<T extends HTMLElement>(
* @returns Element or nothing
*/
export function getActiveElement(): HTMLElement | undefined {
return document.activeElement instanceof HTMLElement
? document.activeElement || undefined
: undefined
return (
document.activeElement?.shadowRoot?.activeElement as HTMLElement ??
document.activeElement as HTMLElement ??
undefined
)
}