Skip to content

ListBoxItem - Adding onFocusChange #7303

Open
@mJarsater

Description

Provide a general summary of the feature here

We are rendering a Tooltip for ListBoxItem if it is truncated. And we want to show it when it is either hovered or focused. But it seems like the ListBoxItem is currently missing a onFocusChange event to know whether or not it is in focus.

🤔 Expected Behavior?

API example:

<ListBoxItem onFocusChange={(isFocused) => doSomething(isFocused)} />

😯 Current Behavior

Currently no event do detect a focus change is exported.

💁 Possible Solution

No response

🔦 Context

<AriaListBoxItem
  onHoverChange={() => evaluateTruncation()}
>
  {item => ( 
      <Tooltip_Default
        triggerRef={objectRef}
        isOpen={isTruncate && (item.isHovered || item.isFocused)}
      >
         <Text_Block slot="label" isTruncated ref={textRef}>
            {typeof children === 'function' ? children(item) : children}
          </Text_Block>
         
      </Tooltip_Default>
  )}
</AriaListBoxItem>

This is a rough draft of what are working with today. We'd like to be able to do:

<AriaListBoxItem
  onHoverChange={() => evaluateTruncation()}
  onFocusChange={() => evaluateTruncation()}
>
  {item => ( 
      <Tooltip_Default
        triggerRef={objectRef}
        isOpen={isTruncate && (item.isHovered || item.isFocused)}
      >
         <Text_Block slot="label" isTruncated ref={textRef}>
            {typeof children === 'function' ? children(item) : children}
          </Text_Block>
         
      </Tooltip_Default>
  )}
</AriaListBoxItem>

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions