ipni / cid.contact

cid.contact Web UI
https://cid.contact
1 stars 1 forks source link

UI and accessibility changes in the header #21

Closed barbaraperic closed 6 months ago

barbaraperic commented 6 months ago

This PR includes several changes to improve the UI and accessibility of the header and dropdown menu. Tested on Chrome, Safari and Firefox.

Change #1: Header structure

Before

Screenshot 2024-03-27 at 11 45 24

Resizing the screen and alignment breaks:

https://github.com/ipni/cid.contact/assets/50910606/4d5e269f-47d2-49fc-852a-d00f628bec39

Scenario of adding more items in the nav, alignment breaks: Screenshot 2024-03-27 at 11 46 05

Safari bug: Screenshot 2024-03-28 at 07 57 33

After

Grid layout: Screenshot 2024-03-27 at 11 43 55

Alignment doesn't break when adding more items: Screenshot 2024-03-27 at 11 44 31

Smoother transitions and no jumps when resizing, and logos stay centered:

https://github.com/ipni/cid.contact/assets/50910606/1240a92d-82c0-440d-9ea1-2fa4969d46c8

Change #2: Hamburger component

I have replaced <span> SVG elements in the dropdown burger button with pseudo elements ::before and ::after. Why? Less HTML code and now the icon can be animated if you decide to in the future. It also reduces the complexity of changing the style - if you wanted to be different length, color and similar. It could also be extracted as it's own component and reused somewhere else in the website.

Change #3: Dropdown UI

Before

Screenshot 2024-03-28 at 07 55 56

After

Screenshot 2024-03-28 at 07 55 39

Change #4: Dropdown accessibility

Before

https://github.com/ipni/cid.contact/assets/50910606/0864105b-a17f-4207-8839-6ff108e7019c

After

https://github.com/ipni/cid.contact/assets/50910606/81abc4e1-e610-466c-8480-3cf925cf9733