mi6 / mi6/ic-ui-kit

Fix the horizontal scroll from stretching the larger component when buttons are added

Open
#667 0 comments 0 reactions 0 assignees View on GitHub
component: ic-top-navigation
Dominant language
TypeScript
Stars
53
Forks
63
Avg merge
2d 4h
Merged PRs (30d)
15

Description

## Summary of the bug
Noticed when investigating [#425](https://github.com/mi6/ic-design-system/issues/425), the cause of the flickering was because adding the horizontal scroll buttons changed the width of a wider element. More information is given in the [pull request](https://github.com/mi6/ic-design-system/pull/449) for the original issue.

## 🪜 How to reproduce
1. Go to https://design.sis.gov.uk/components/top-nav
2. Edit the initial code example to add another navigation item
3. Open the devtools to adjust the screen size
4. At roughly 1021px the screen will flicker as at that size the changing sizes causes an infinite loop in the Resize Observer.

## 🧐 Expected behaviour
The components, when adding in the scroll buttons, should maintain their size. The buttons should not stretch the larger component.

## 📸 Screenshots or code
Before buttons added (Width: 668px)
![Screenshot from 2023-05-10 16-26-41](https://github.com/mi6/ic-ui-kit/assets/117368893/ca9983c8-3335-417a-9e1a-2dcfd33f9b1f)

After buttons added (Width: 715.48px) It should remain at 668px
![Screenshot from 2023-05-10 16-22-23](https://github.com/mi6/ic-ui-kit/assets/117368893/1dc84ebe-3b84-42a4-8ddb-703861f6e022)

Contributor guide

Open the contributing guide

Research direction

Start with the top-nav component at design.sis.gov.uk and reproduce the flicker by adding a navigation item and resizing around 1021px. Read issue #425 and pull request #449 for the original investigation. Done means the scroll buttons do not stretch the larger component from 668px and the Resize Observer no longer enters an infinite loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.