Skip to content

Marking Component As Non-Interactive If Hover/Unhover Hooks Are Not Exists#654

Open
suresh-gangumalla wants to merge 7 commits intolightning-js:devfrom
suresh-gangumalla:omit-overlay-components
Open

Marking Component As Non-Interactive If Hover/Unhover Hooks Are Not Exists#654
suresh-gangumalla wants to merge 7 commits intolightning-js:devfrom
suresh-gangumalla:omit-overlay-components

Conversation

@suresh-gangumalla
Copy link
Copy Markdown
Collaborator

Component's hoverable configuration property will alter holder node interactive flag

Component's hoverable  configuration property will
alter holder node `interactive` flag

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Test Results: ✅ PASSED

Run at: 2026-04-07T08:58:52.179Z

Summary:
passed: 1178 failed: 8 of 1186 tests

@michielvandergeest
Copy link
Copy Markdown
Collaborator

hey @suresh-gangumalla, this looks good! But it does mean that we're introducing a somewhat arbitrary component config prop.

I had another idea, and I'm not sure how feasible it is, but it would make this whole thing pretty "automagic": what if we keep the generator the same (i.e. setting holder prop to true for all components) and then in the holder prop we verify if the component has a hover (or unhover, would that make sense to track separately?) hook specified. And if it does the component is considered to be hoverable

can you look into that approach?

if component does not registered hover/unhover hooks in component
configuation then that component subjected to non interactive by setting
`interactive` on holder node to false.

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-04-15T12:42:24.919Z

Summary:
Tests passed. No summary found in output.

@suresh-gangumalla suresh-gangumalla changed the title Added hoverable config property Marking Component As Non-Interactive If Hover/Unhover Hooks Are Not Exists Apr 15, 2026
Comment thread src/engines/L3/element.js Outdated
Comment on lines +532 to +535
const identifier =
this.element && this.element.component
? this.element.component[symbols.identifier]
: undefined
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the use cases where this.element and this.element.component are undefined?

Comment thread src/engines/L3/element.js Outdated
Comment on lines +538 to +540
} else {
this.props['interactive'] = v
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we not skip this else block?

Comment thread src/lib/hooks.js Outdated
}

export const hasHook = (hook, identifier) => {
return !!(cbs[identifier] && cbs[identifier][hook])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rewrite to cbs[identifier] !== undefined && hook in cbs[identifier] ?

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-04-16T06:01:30.060Z

Summary:
Tests passed. No summary found in output.

Detecting $isHovered from template and checking whether
component holder node should be interactive or not based on
$isHovered or hover/unhover hooks.

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-04-23T11:45:28.965Z

Summary:
passed: 1192 failed: 9 of 1201 tests

from template and from JS layer detecting whether any component
holding reference to $isHovered then marking that component's
holder node as interactive otherwise non-interactive

For router page components, holder node will be created by router not
code-generator like regular children component's inside a page
component.

Router page components are two types, lazy import and normal direct
import. We can't alter (even we have alter also renderer doesn't
remove/add it from hierarchy pattern) any node interactivity once it
created so for normal import we can invoke needsInteractity function
in component's factory which will return whether component's holder node
need to be marked interactive or not based on folliwng conditions
 1. Existance of hover/unhover hook in component config
 2. Existance of $isHovered in template which will be inspected at
    pre-compile or run time compilation
 3. Existance of this.$isHovered in JS layer of component

     This step is challening, in users opted for pre-compilation, it
     will be like finding existance of this.$isHovered in a source code
     If not, we will loop through all JS layer functions and stringy
     then look for this.$isHovered.

 So, finally dynamic imported router page component's holder node always
 interactive.

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-04-24T12:14:04.256Z

Summary:
passed: 1200 failed: 0 of 1200 tests

@github-actions
Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-04-28T11:28:03.415Z

Summary:
passed: 1200 failed: 0 of 1200 tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants