Make the on-hover detail panel in infoboxes more generic and reusable.
Review Request #9082 — Created July 16, 2017 and submitted
The user infobox includes a nifty on-hover panel for the timestamp,
showing the last logged in time and joined date. The implementation was
a bit specific to the user infobox (partly due to the way it was
positioned and the hover triggered), but this change makes it more
generic and usable for other infoboxes, allowing it to be placed
anywhere in the infobox.The new implementation provides standard CSS rules and a structure for
the hover panel. There's now a containing element
(.infobox-hover-item
) with an anchor that triggers the display
(.infobox-hover-item-anchor
) and the panel contents that will be shown
(.infobox-hover-item-contents
). Unlike the previous implementation,
this one doesn't absolutely position the main container, meaning that it
can sit directly above and below other content without affecting the
flow of those elements.There's also a
.infobox-item
class for items that don't have a hover
rule. This enables us to have consistent spacing for all detail items.With the new implementation, we can no longer depend on
:hover
(since
the element used for it is now positioned relatively alongside the panel
instead of absolutely inside of it, and the panel is shown/hidden based
on the hover instead of its child elements). Instead, the hover
functionality now lives in JavaScript, and is common to all infoboxes.
In theory, infoboxes could have multiple of these hover panels and
they'd all work.
Tested that the user infobox's hover panel worked, and continued to work
as I switched between users and re-rendered the infobox.Tested these CSS rules with new infobox content for review requests
(coming in another change).
- Change Summary:
-
- Moved some CSS rules down a bit.
- Moved the
infobox-hover-item-content
rules out of:hover
and into the main rule. - Removed an empty CSS rule.
- Added missing "Args" in JavaScript docs.
- Commit:
-
e01e43c99f0e4579e0233fc3696e7a7fd33e37175065c99349dd99ac57411f644b815dfcccae7890
Checks run (2 succeeded)
- Change Summary:
-
- Fixed the hover anchor's border to not cover the icon. There's now a
<label>
within.infobox-hover-item-anchor
that defines the text portion. - Fixed up spacing around the items (the timestamp and e-mail address on the user infobox) by adding a new
.infobox-item
instead of using<p>
. This means more consistency in the spacing. - Added some spacing between items in the hover panels, to improve readability.
- Reduced some of the padding in the hover panel to compensate for the spacing changes above, to help ensure the panel fits nicely in the user infobox and others, and is more generally consistent.
- Fixed the hover anchor's border to not cover the icon. There's now a
- Description:
-
The user infobox includes a nifty on-hover panel for the timestamp,
showing the last logged in time and joined date. The implementation was a bit specific to the user infobox (partly due to the way it was positioned and the hover triggered), but this change makes it more generic and usable for other infoboxes, allowing it to be placed anywhere in the infobox. The new implementation provides standard CSS rules and a structure for
the hover panel. There's now a containing element ( .infobox-hover-item
) with an anchor that triggers the display( .infobox-hover-item-anchor
) and the panel contents that will be shown( .infobox-hover-item-contents
). Unlike the previous implementation,this one doesn't absolutely position the main container, meaning that it can sit directly above and below other content without affecting the flow of those elements. + There's also a
.infobox-item
class for items that don't have a hover+ rule. This enables us to have consistent spacing for all detail items. + With the new implementation, we can no longer depend on
:hover
(sincethe element used for it is now positioned relatively alongside the panel instead of absolutely inside of it, and the panel is shown/hidden based on the hover instead of its child elements). Instead, the hover functionality now lives in JavaScript, and is common to all infoboxes. In theory, infoboxes could have multiple of these hover panels and they'd all work. - Commit:
-
5065c99349dd99ac57411f644b815dfcccae7890d1657c4ee769d3f32cf0fdb9185873ef25d5ecfa
- Diff:
-
Revision 3 (+132 -67)
- Added Files: