Skip to content

Commit

Permalink
Fixed capturing of keyboard events for custom elements
Browse files Browse the repository at this point in the history
Co-authored-by: vtsvetkov-splunk <[email protected]>
  • Loading branch information
squidfunk and vtsvetkov-splunk committed Jan 24, 2024
1 parent 6128ab9 commit be95f49
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion material/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions material/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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") -%}
Expand Down Expand Up @@ -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 %}
Expand Down
8 changes: 5 additions & 3 deletions src/templates/assets/javascripts/browser/element/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

0 comments on commit be95f49

Please sign in to comment.