feathersui-starling icon indicating copy to clipboard operation
feathersui-starling copied to clipboard

PickerList does not work when above Away3D View3D

Open SirGordon opened this issue 9 years ago • 2 comments

using MetalWorksDesktopTheme on PC

  1. Make, for example, a panel, add a PickerList there with some items in data provider.
  2. Establish Away3D View3D with size of the screen
  3. Open the PickerList using mouse in a way so items appear above Away3D View3D.
  4. Try to pick an item

Expected result: new item is selected Actual result: selected item is not changed

P.S. Other components with pop-ups like in PickerList are probably affected too

SirGordon avatar Jul 28 '15 20:07 SirGordon

It's likely that Away3D adds something to the native stage that can receive focus. If a native display object that can receive focus is above a Feathers component, then the FocusManager will give it precedence. From DefaultFocusManager:

protected function stage_mouseFocusChangeHandler(event:FocusEvent):void
{
    if(event.relatedObject)
    {
        //we need to allow mouse focus to be passed to native display
        //objects. for instance, hyperlinks in TextField won't work
        //unless the TextField can be focused.
        this.focus = null;
        return;
    }
    event.preventDefault();
}

As noted in the comment there, certain functionality can break if things on the native display object aren't allowed to have focus. The bit about TextFields is particularly important for the Feathers ScrollText component. However, it would certainly affect other interactive display objects on the native stage too.

An easy way to check if this is what's happening would be to disable the FocusManager after you instantiate MetalWorksDesktopTheme.

FocusManager.setEnabledForStage(this.stage, false);

The PickerList should become properly interactive again because the focus manager won't clearing its focus from its pop-up list. However, keyboard navigation with the tab key will no longer work. That may or may not be acceptable.

Unfortunately, I'm not sure if there's a good way to exclude some native stage display objects from the focus manager's default behavior. I'll have to think about it.

joshtynjala avatar Jul 28 '15 20:07 joshtynjala

Instant as always, thank you Josh!

SirGordon avatar Jul 28 '15 20:07 SirGordon