Skip to content

Commit

Permalink
Added popover polyfill for a landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
owsiakl committed Feb 3, 2024
1 parent ef20f21 commit 99bef1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/web/landing/assets/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@fontsource-variable/cabin/index.min.css';
import 'highlight.js/styles/github-dark.min.css';
import '@oddbird/popover-polyfill';
import './bootstrap.js';
12 changes: 12 additions & 0 deletions src/web/landing/importmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@
'version' => '5.0.17',
'type' => 'css',
],

/**
* On mobile there is a collapsible menu that uses relatively new popover attribute,
* but it's not yet available in a firefox browser: https://caniuse.com/?search=popover.
* This polyfill will make it work there.
*
* Once it's available, run 'bin/console importmap:remove @oddbird/popover-polyfill'
* and remove import from 'landing/assets/app.js'.
*/
'@oddbird/popover-polyfill' => [
'version' => '0.3.8',
],
];
2 changes: 1 addition & 1 deletion src/web/landing/templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<img src="{{ asset('images/icons/menu.svg') }}" alt="menu" class="" >
</button>

<nav popover id="main-nav" class="relative p-0 m-0 max-sm:top-0 max-sm:right-0 sm:block text-white bg-blue-200 unset">
<nav popover id="main-nav" class="max-sm:absolute border-0 p-0 m-0 max-sm:top-0 max-sm:right-0 sm:relative sm:block text-white bg-blue-200 unset">
<ul class="sm:flex flex-nowrap whitespace-nowrap">
<li class="sm:hidden text-right">
<button popovertarget="main-nav" popovertargetaction="hide" class="sm:hidden h-16 pr-4">
Expand Down

0 comments on commit 99bef1e

Please sign in to comment.