Add consistent layout and state for actions and a button action template.
Review Request #14423 — Created May 4, 2025 and submitted
This introduces a few changes to help write actions and ensure they work
in a consistent way in multiple places.There's now an
action_base.html
template that handles the general
structure of an action. This provides the parentrb-c-actions__action
container with some consistent attributes, plus template variables for
use in derived templates. Derived templates can use this to build their
elements and to influence the parent container state.This gives us more consistent templates and helps us set some new
attributes for visibility management. We use bothhidden
and
display: none
(the latter being necessary sincedisplay
can override
the former). From that, we can better manage the accessibility tree and
check for state more directly.
RB.ActionView
provides the other end of the visibility management.
Visibility is now managed on the parent action container element, if
used, so that we don't end up with empty<li>
elements affecting
layout when actions are hidden. If nested in another container (such as
a menu), the action's own element is used.
ActionView.show()
andhide()
update bothdisplay
andhidden
,
using the visibility element. AnisVisible()
method returns the state
based on that as well.Along with this, there are a few small typing and function signature
fixes I hit during development, plus error handling when action
templates fail to render.These will make it easier to implement some new action functionality
coming in a follow-up change.
Tested all the current actions in the UI, looking for visual breakages
or issues invoking the actions.Unit tests pass.
Tested the new functionality with in-progress changes.
- Change Summary:
-
Removed an unused import.
- Commits:
-
Summary ID f86c95849a111547443819cfd9bbdd7ece16f920 c0b81fbef06ea6b5fdfba131f0e7069ea478426e - Diff:
-
Revision 2 (+384 -72)
Checks run (2 succeeded)
- Change Summary:
-
Removed empty CSS classes.
- Commits:
-
Summary ID c0b81fbef06ea6b5fdfba131f0e7069ea478426e 6c2e24e494233d88a1691cb24ba7512c22acecb8 - Diff:
-
Revision 3 (+386 -74)
Checks run (2 succeeded)
- Change Summary:
-
Added caching of the action's visibility element.
- Commits:
-
Summary ID 6c2e24e494233d88a1691cb24ba7512c22acecb8 a499c7662935d63a3f123b89d0f9992a143e331f - Diff:
-
Revision 4 (+432 -74)
Checks run (2 succeeded)
- Change Summary:
-
Removed a comment about django-stubs that no longer applies.
- Commits:
-
Summary ID a499c7662935d63a3f123b89d0f9992a143e331f 52f855cb39ee28122bbf2255a63c71e33a93dbd2 - Diff:
-
Revision 5 (+432 -76)
Checks run (2 succeeded)
- Change Summary:
-
Fixed more
should_render()
signatures. - Commits:
-
Summary ID 52f855cb39ee28122bbf2255a63c71e33a93dbd2 3b97b3043b8ae289682175dfeac5973c0cb1505c - Diff:
-
Revision 6 (+442 -76)
Checks run (2 succeeded)
- Change Summary:
-
- Added back a missing line.
- Switched menu width to use the outer width.
- Commits:
-
Summary ID 3b97b3043b8ae289682175dfeac5973c0cb1505c 3af2b1f651acdf08903ebcf47250fa2ba308b89d - Diff:
-
Revision 7 (+448 -78)
Checks run (2 succeeded)
- Change Summary:
-
Undid the previous update. Wrong change.
- Commits:
-
Summary ID 3af2b1f651acdf08903ebcf47250fa2ba308b89d 19dd1e982b4268359b672e03331860d5604bdf68 - Diff:
-
Revision 8 (+442 -76)