diff --git a/src/Twig/Extension.php b/src/Twig/Extension.php
index 5501665190..d60329fbf7 100644
--- a/src/Twig/Extension.php
+++ b/src/Twig/Extension.php
@@ -58,6 +58,7 @@ class Extension extends AbstractExtension
new TwigFunction('handle_event', [Runtime::class, 'handleEvent']),
new TwigFunction('config', [Runtime::class, 'getConfig']),
new TwigFunction('icon', [Runtime::class, 'embedSvgIcon'], ['needs_environment' => true]),
+ new TwigFunction('is_firefox', [Runtime::class, 'isFirefox']),
];
}
}
diff --git a/src/Twig/Runtime.php b/src/Twig/Runtime.php
index 42e3676aef..bdba0717c9 100644
--- a/src/Twig/Runtime.php
+++ b/src/Twig/Runtime.php
@@ -116,6 +116,12 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
return $twig->render('@public_path/assets/icons/' . $icon_name . '.svg.twig', ['iconClass' => $icon_css_class]);
}
+ public function isFirefox(): bool
+ {
+ $re = '/.*(?i)\bfirefox\b.*/m';
+ return preg_match(pattern: $re, subject: $this->request->headers->get('User-Agent')) === 1;
+ }
+
// ----------------------------------------------------------
/**
diff --git a/templates/base.html.twig b/templates/base.html.twig
index f1047d795d..895fd7f6e1 100644
--- a/templates/base.html.twig
+++ b/templates/base.html.twig
@@ -37,9 +37,11 @@
- Firefox based browser: Alt + Shift + "access key"
-
- Others: Alt + "access key"
+ {% if is_firefox() == true %}
+ Alt + Shift + "access key"
+ {% else %}
+ Alt + "access key"
+ {% endif %}