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

Pressing key Home or End breaks Affix positioning #15847

Closed
gustavohban opened this issue Feb 19, 2015 · 5 comments
Closed

Pressing key Home or End breaks Affix positioning #15847

gustavohban opened this issue Feb 19, 2015 · 5 comments

Comments

@gustavohban
Copy link

You can check this right on the Bootstrap website.
I was able to replicate this issue using Chrome and IE 11.
Firefox worked fine.

How to reproduce:

Using end key:

1 - Navigate to http://getbootstrap.com/css/
2 - Without scrolling, press the keyboard key ''end"

** The affix element is supposed to go through .affix-top to .affix-bottom, but instead the final class is .affix

issue2-affix-1

Using home key:

1 - Navigate to http://getbootstrap.com/css/
2 - Scroll down the page until you reach the bottom/footer
3 - At the bottom, press the key "home"

** Is the same problem, but now the affix element is supposed to go trough .affix-bottom to .affix-top, but again the final class is .affix

issue-affix-5

@cvrebert
Copy link
Collaborator

Duplicate of #9609.

@cvrebert cvrebert added the js label Feb 19, 2015
@kkirsche
Copy link
Contributor

Is it due to performance that the Affix plugin doesn't use @fat's snippet or something similar watching for a home / end key press or is there another reason?

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 9, 2015

I'm guessing he considered the missing scroll event to be a browser bug.
The thing is, at least on OS X, current Chrome does fire a scroll event when pressing the equivalent of Home/End, yet the Affix positioning bug still occurs.

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 9, 2015

Seems to me like there's a bug in the Affix.prototype.getState() logic.
When in the bottom state, top can never be returned as the new state, although that's exactly what seems to be needed here.
If you're at the bottom of the page, this.affixed is bottom and getState returns bottom.
If you then press Home to go to the top of the page, the scroll event changes the state from bottom to false, which leaves the affixed element positioned incorrectly.
If you then fire a dummy scroll event via $(document).trigger('scroll'), the state changes from false to top, which corrects the affixed element's position.

@mdo
Copy link
Member

mdo commented Sep 5, 2016

Bootstrap 3 is no longer being officially developed or supported.

All work has moved onto our next major release, v4. As such, this issue or pull request is being closed as a "won't fix." For additional help and support, we recommend utilizing our community resources. Thanks for your understanding, and see you on the other side of v4!

<3,
@mdo and team

@mdo mdo closed this as completed Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants