Needs work
Project:
BS Base
Version:
2.0.x-dev
Component:
BS Bootstrap
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Oct 2019 at 16:03 UTC
Updated:
4 Aug 2025 at 07:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pivica commentedHere is a patch.
Comment #3
berdirSee #2912092: State required asterisk doesn't show, maybe we should rely on the core fix instead of duplicating it?
Comment #4
pivica commentedThe main problem here is that in addition to CSS require classes we are also using an additional span element for required mark in bs_bootstrap/templates/form/form-element-label.html.twig:
This additional span required element was introduced in https://git.drupalcode.org/project/bs_base/commit/e9785a3 because of Bootstrap custom element support for radio/checkbox CSS styles, which were conflicting with our old required pseudo styles. Bootstrap custom radio/checkbox use both before and after pseudo-elements so there is no room for our custom required pseudo-element.
Additionally Bootstrap does not have visual styles for required elements like Drupal have, what it has is a client validation framework which will mark required fields on form submit. This creates additional potential problems for us.
So what we need to do here is to do the same thing that Drupal is doing and on state require change inject or remove span.form-required-mark and that is what the code in the patch is doing - it is not adding or removing CSS classes because Drupal state.js code is doing that, it is just running after that code and managing span element.
I've checked patch in #2912092: State required asterisk doesn't show, it seems that JS selectors in the core is not covering all possible elements (also there is #2419131: [PP-1] #states attribute does not work on #type datetime for datetime element). We should wait with this patch until core issues are fixed and then use JS selectors like core is doing.
Comment #5
pivica commentedUpdated patch against latest dev version and patches that will go into next release.
Comment #6
pivica commentedBoth core issues are still open, moving this to 2.x.
Comment #7
pivica commentedComment #8
pivica commentedPatch is updated against #3474789: Deprecate bs_bootstrap subtheme merge request. Moved this to bs_base, added missing jQuery dependency in library definition and removed Drupal var from JS code.
Keeping this still in patch for now and when 3474789 gets in we could create MR if needed.
Comment #10
pivica commentedThis conflicted with latest 2.0.x version. Fixed and also switched from var to const for variables.