@@ -31,25 +31,40 @@ export const cssSelectPrimitiveComponentAdapter: Required<
3131 return node . _parsedProps . name
3232 }
3333
34- // Special case for _isnormalcomponent -> _isNormalComponent mapping
35- if ( name === "_isnormalcomponent" && "_isNormalComponent" in node ) {
36- const value = ( node as any ) . _isNormalComponent
34+ // Handle other attribute selectors based on props
35+ if ( node . _parsedProps && name in node . _parsedProps ) {
36+ const value = node . _parsedProps [ name ]
37+ // css-select might expect string values for attributes
3738 return typeof value === "string"
3839 ? value
3940 : value !== null && value !== undefined
4041 ? String ( value )
4142 : null
4243 }
43- // Handle other attribute selectors based on props
44- if ( node . _parsedProps && name in node . _parsedProps ) {
45- const value = node . _parsedProps [ name ]
46- // css-select might expect string values for attributes
44+
45+ // Check for properties directly on the node (css-select converts names to lowercase)
46+ // Try both the lowercase name and camelCase variants
47+ if ( name in node ) {
48+ const value = ( node as any ) [ name ]
49+ return typeof value === "string"
50+ ? value
51+ : value !== null && value !== undefined
52+ ? String ( value )
53+ : null
54+ }
55+
56+ // Try to find a camelCase property that matches the lowercase attribute name
57+ const nodeKeys = Object . keys ( node )
58+ const matchingKey = nodeKeys . find ( ( key ) => key . toLowerCase ( ) === name )
59+ if ( matchingKey && matchingKey in node ) {
60+ const value = ( node as any ) [ matchingKey ]
4761 return typeof value === "string"
4862 ? value
4963 : value !== null && value !== undefined
5064 ? String ( value )
5165 : null
5266 }
67+
5368 return null
5469 } ,
5570
@@ -60,7 +75,17 @@ export const cssSelectPrimitiveComponentAdapter: Required<
6075 return ! ! node . _parsedProps ?. name
6176 }
6277 // Check for other attributes based on props
63- return node . _parsedProps && name in node . _parsedProps
78+ if ( node . _parsedProps && name in node . _parsedProps ) {
79+ return true
80+ }
81+ // Check for properties directly on the node
82+ if ( name in node ) {
83+ return true
84+ }
85+ // Try to find a camelCase property that matches the lowercase attribute name
86+ const nodeKeys = Object . keys ( node )
87+ const matchingKey = nodeKeys . find ( ( key ) => key . toLowerCase ( ) === name )
88+ return ! ! matchingKey && matchingKey in node
6489 } ,
6590
6691 // Get the siblings of the node
0 commit comments