[Bug] Combinator selector applies for entire group instead of particular position
See original GitHub issueI have a use case where I want to create the following (simple) condition: (foo AND bar OR xyz)
.
Using the demo page I tried to add 3 rules and then change the second combinator to OR
. Immediately after changing it to OR
, the first combinator also changed to OR
.
After doing some tests it seems that the combinator’s behaviour is buggy. Changing one of the combinators causes all other combinators at the same group level to change (to the same value).
I recorded a video demoing the bug:
https://user-images.githubusercontent.com/89727/122836916-7c589c80-d2f3-11eb-9eef-55dd5bc07a6e.mov
Issue Analytics
- State:
- Created 2 years ago
- Comments:30 (16 by maintainers)
Top Results From Across the Web
Descendant combinator - CSS: Cascading Style Sheets | MDN
Selectors that utilize a descendant combinator are called descendant selectors. /* List items that are descendants of the "my-things" list */ ul ...
Read more >CSS Selector that applies to elements with two classes
Chain both class selectors (without a space in between): .foo.bar { /* Styles for element(s) with foo AND bar classes */ } ...
Read more >Selectors Level 3 - W3C
Abstract. Selectors are patterns that match against elements in a tree, and as such form one of several technologies that can be used...
Read more >Selectors - web.dev
You use a CSS selector to find that specific element and apply a CSS rule, ... combinators help you select items based on...
Read more >Group Selector in CSS - YouTube
CSS Tutorial 15 - CSS Group Selector ... the link for next video: CSS Tutorial 16 - CSS Combinator Selector | CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think I’m actually changing my mind about this one. I’ve started looking into adding an
inlineCombinators?: boolean
prop that would flip the<QueryBuilder />
component from usingRuleGroupType
for thequery
andonQueryChange
props to using a new type (tentatively namedRuleGroupTypeIC
) that would remove thecombinator
attribute and allow strings in therules
array. The intent would be to allow something like this:The
RuleGroup
component would render an independentcombinatorSelector
between each pair of rules.I’ve got the functionality mostly working (along with modifications to
formatQuery
andparseSQL
), but the TypeScript types are giving me headaches since I’m trying to maintain backwards compatibility and not export a completely separate base component. Once I get some good feedback on this r/typescript post, I’ll fix up the types and create a PR that we can look at before merging.Hey @jakeboone02 ! Sorry for the long delay in the response; took some vacations (holidays and so). I tested the 4.0 and everything looks good! The dnd bug is completely gone. I have just one small complaint about breaking compatibility on the format level, but I’ll open a new bug for that.
Kudos for the great work!