Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel: use buttons, not links, for prev/next controls #32627

Merged
merged 20 commits into from Jan 27, 2021

Conversation

patrickhlauke
Copy link
Member

@patrickhlauke patrickhlauke commented Dec 27, 2020

  • expand the styles to neutralise border/background
  • change docs page
  • add extra unit test to check that links or buttons work as controls
  • modify visual test to use buttons as well

Preview https://deploy-preview-32627--twbs-bootstrap.netlify.app/docs/5.0/components/carousel/

- expand the styles to neutralise border/background
- change docs page
- add extra unit test to check that links or buttons work as controls
- modify visual test to use buttons as well
@patrickhlauke
Copy link
Member Author

to clarify: using links still works, but it's not really semantically correct. not a breaking change, as the old markup still works. just better/cleaner to do it using <button>

@patrickhlauke
Copy link
Member Author

patrickhlauke commented Dec 28, 2020

this will need to be expanded if #32638 (and the v4 backport of that #32639) lands first

@patrickhlauke patrickhlauke marked this pull request as draft December 29, 2020 13:41
@patrickhlauke
Copy link
Member Author

temporarily set to draft while i expand this following merging of #32638

@patrickhlauke patrickhlauke marked this pull request as ready for review December 29, 2020 16:28
@patrickhlauke patrickhlauke marked this pull request as draft January 5, 2021 20:48
@patrickhlauke
Copy link
Member Author

setting to draft to make sure the added carousel section (disabled touch) is added appropriately

@patrickhlauke patrickhlauke marked this pull request as ready for review January 5, 2021 21:01
@patrickhlauke
Copy link
Member Author

ah, my mistake, i see this won't be affected by my planned upcoming change. as you were

@XhmikosR
Copy link
Member

XhmikosR commented Jan 7, 2021

There are more instances in examples?

Also, perhaps we should have callout/example mentioning that both work but for whatever reasons we suggest buttons?

- use buttons instead of links for prev/next
- remove `role="button"` from links that are actually links
@patrickhlauke
Copy link
Member Author

There are more instances in examples?

Ah, good catch, those slipped me by. Addressed now.

Also, perhaps we should have callout/example mentioning that both work but for whatever reasons we suggest buttons?

the "for whatever reason" part of your comment worries me a bit. i thought we (at least in core team) all understood/aknowledged that links are for linking (to another page, or a section within the current page like a skip anchor) and buttons are for dynamic in-page actions.

i'll add a little mention/note about this though in a moment, sure.

@XhmikosR
Copy link
Member

XhmikosR commented Jan 26, 2021

@patrickhlauke Is it intentional that the carousel controls sort of jumpmove when clicked? Firefox 85 on Windows 10. Edge Chromium seems to be the same as before.

@patrickhlauke
Copy link
Member Author

@patrickhlauke Is it intentional that the carousel controls sort of jumpmove when clicked? Firefox 85 on Windows 10. Edge Chromium seems to be the same as before.

ah, good catch, hadn't even checked. no, wasn't intentional. forgot about Firefox's quirky behaviour of adding extra padding on :active. neutralised this now by explicitly setting padding: 0 for the prev/next controls

@XhmikosR
Copy link
Member

Now, it looks good to me, thanks! One last comment and also I wonder, do we have an issue about this?

@patrickhlauke
Copy link
Member Author

Now, it looks good to me, thanks! One last comment and also I wonder, do we have an issue about this?

we have this meta-issue where i reel off various things that should get fixed #31186 but no atomic issue about just this aspect i think. can do a trawl through open issues after this just to check though

@XhmikosR XhmikosR changed the title Carousel: use buttons, not links, for prev/next Carousel: use buttons, not links, for prev/next controls Jan 27, 2021
@XhmikosR XhmikosR removed this from Inbox in v5.0.0-beta3 Jan 27, 2021
@XhmikosR XhmikosR added this to Inbox in v5.0.0-beta2 via automation Jan 27, 2021
@XhmikosR XhmikosR moved this from Inbox to Approved in v5.0.0-beta2 Jan 27, 2021
@XhmikosR XhmikosR merged commit 3aa3fda into main Jan 27, 2021
v5.0.0-beta2 automation moved this from Approved to Done Jan 27, 2021
@XhmikosR XhmikosR deleted the patrickhlauke-carousel branch January 27, 2021 15:31
@patrickhlauke
Copy link
Member Author

👍 thanks for sanity checking @XhmikosR

@XhmikosR XhmikosR added this to Inbox in v4.6.1 via automation Feb 10, 2021
@XhmikosR XhmikosR moved this from Inbox to Needs manual backport in v4.6.1 Feb 15, 2021
patrickhlauke added a commit that referenced this pull request Feb 21, 2021
@patrickhlauke patrickhlauke moved this from Needs manual backport to Cherry-picked/Manually backported in v4.6.1 Feb 21, 2021
@XhmikosR XhmikosR removed this from Cherry-picked/Manually backported in v4.6.1 Feb 22, 2021
XhmikosR pushed a commit that referenced this pull request Mar 11, 2021
Carousel: use buttons, not links, for prev/next controls
XhmikosR pushed a commit that referenced this pull request Mar 11, 2021
Carousel: use buttons, not links, for prev/next controls
maxokorokov added a commit to maxokorokov/ng-bootstrap that referenced this pull request Feb 22, 2022
- In Bootstrap 5 the CSS selector matching indicators has changed and included `data-bs-target` attribute that we were missing
- Recommended carousel markup changed from using `ul`, `li` and `a` to using `button` elements
- Had to refactor tests as selectors were not precise enough

On Bootstrap side see:
- twbs/bootstrap#32661
- twbs/bootstrap#32627

Fixes ng-bootstrap#4200
Fixes ng-bootstrap#4253
maxokorokov added a commit to ng-bootstrap/ng-bootstrap that referenced this pull request Feb 23, 2022
- In Bootstrap 5 the CSS selector matching indicators has changed and included `data-bs-target` attribute that we were missing
- Recommended carousel markup changed from using `ul`, `li` and `a` to using `button` elements
- Had to refactor tests as selectors were not precise enough

On Bootstrap side see:
- twbs/bootstrap#32661
- twbs/bootstrap#32627

Fixes #4200
Fixes #4253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.0.0-beta2
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants