-
Notifications
You must be signed in to change notification settings - Fork 249
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
In-course links in Notify content disable scrolling #1675
Comments
Would something as simple as this work? |
you just need to check the link target, a link going to a new window doesn't need to close the popup. |
or re-enable scrolling on navigation? |
or drop the disable scrolling behaviour? it is a bit rubbish (i know cos i wrote it). |
Lol. Returning to the same place does make sense. Like if you scroll when notify is open you could lose your place. Close notify ensures that the notify class is removed from html as well as scrolling re-enabled. See #1679 |
I'd tend to agree with Ollie aiming more towards a re-enable-on-navigation-style approach. Hardcoding an You may have a button which performs |
Sounds fair Tom but all the handler does is calls closeNotify, which makes sure that notify closes, class is removed from html and scroll is re-enabled, on the condition that target !== "_blank". I can't think of a use case where this behaviour would not be required. Notice that I have not called event.preventDefault meaning that as per your example Adapt.navigateToElement would still get called. This handler just ensures the other essential stuff happens as well :) |
The only problem I can really think of with @danielstorey 's solution is that you might have an If this is a concern then a possible alternative would be to require links or buttons to have some kind of attribute that flags that notify should be closed. I'd normally plump for a Equally I'm happy to go with the solution as-is - and if we find it's not working out we can sort it out then. |
Bit hacky but could use classes instead of data attributes? Didn't know data attrs were difficult to add... |
A few possible use cases for anchors:
To be honest, I was more worried about the bigger picture – if any navigation happens while in a Notify, you'll get the same frozen scrolling bug – |
Ok it's now sounding like the most sensible thing to do would be to call closeNotify when the route changes. Something like this.listenTo(Adapt, "router:location", this.closeNotify); How does that sound? |
It's just a question of where you put it, where you remove the event listener and ensuring it only happens once. But yea, totally a better solution. |
Well thanks to Backbone listeners get removed with the view. I think this cracks it though. |
If you include a hyperlink to another part of the course inside a Notify popup, the link works but scrolling is subsequently completely disabled.
This is presumably down to notifyView disabling scrolling when a Notify popup gets opened - but is not being given the chance to re-enable it again because clicking the link will cause Adapt to route to the new location without calling
closeNotify
.Looking at the code I suspect this will also have an impact on accessibility, though I haven't tested that.
It seems reasonable to me that someone would want to add a link to another part of the course to a Notify popup - in this particular case it was to direct the user to a part of the course they needed to revisit because they'd answered a question incorrectly - so it would be great to get this working.
The text was updated successfully, but these errors were encountered: