-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Notable traits popup position issue #91290
Comments
My understanding is that there is a way to do this in CSS positioning but I don't really know it |
I think there is a way in CSS as well, but I don't know it either. |
I would like to propose we treat this as a reason to render this box using JS. Already this box causes us some HTML non-conformance since we have a div inside a |
I'm fine with that. Perhaps we can try to make this work via HTML-attribute-set events instead of doing a for loop over all the elements and attaching listeners (which we used to do, wasn't great) |
I had in mind to add a |
Thinking about what you said @jsha about duplication: do you mean having like an array objects for notable traits on each HTML page and the |
What was the not-great part? Performance? We currently have a loop over all
I meant that often a single type is returned from many different methods, but the contents of the "Notable Traits" box are the same each time. So for instance,
I discussed the desired hover/click behavior here: #91100. In general I'm a fan of refactoring one thing at a time, which would mean keeping the current behavior (hover only) while doing this refactoring, and then as a follow-on adding a click behavior so things work on touchscreen devices. |
Ok! My current work is click-based but since it's JS, it's pretty easy to change. |
I don't think we should need a global array, we should still have the element be nearby in a way that's easy to find via js |
It has a few advantages: no more duplicates and one file for a crate. The only thing I store in the DOM is the position in the array. |
So we should definitely not have a single global onclick handler that handles dispatch. We used to do this for collapsing and it was a mess . This kind of thing ends up reimplementing event dispatch badly and other events tend to interact poorly with it. Here's what I think we should do:
|
Agree.
This doesn't address the issue I raised earlier:
One of the impacts of that issue is that It also doesn't save us any page size. That said, I realize I'm violating the same principle I raised earlier, of refactoring one thing at a time. :-) So if we want to move the HTML generation as a separate issue, I'm fine with that.
I prefer not to use the
I'm okay with this.
In my preferred plan, |
Yeah we can tweak the generation slightly to make it a sibling instead of a child Regarding onclick; I meant mouseover (and whatever needed to make taps work(. What's the CSP interaction? Does it prevent us from using any attributes for events? |
Pretty much, yeah. See https://csp.withgoogle.com/docs/adopting-csp.html. You can allow them with |
Hmmm. In that case I guess we should do the for loop thing, but I'd still prefer to not have any kind of separate map or anything; either we include the stuff in |
Fixed by #104177 |
When it's present on the item of the page (and too far on the right) and the width of the screen is too small, the popup breaks the page flow:
And when you scroll to see the popup content:
The best way to handle this would be to position it to the left instead of the right of the
i
depending of its width andi
position, but I don't see a way to do it just using CSS. We also can't simply put it on the left by default because we might have the same issue but on the other side.cc @Manishearth
The text was updated successfully, but these errors were encountered: