123
Views
2
Comments
When popup is showing, How to Prohibit focusin background
Question
Application Type
Reactive

When a popup is showing, I set focus on first input widgt of popup page , then  I continued press [Tab key] of keyboard, and after the last input widgt of popup page lost its focus, the focus into the backpage input widgt?  Isn't it strange? the backpage is noable to  operation。

Queation is: When a popup is showing, How to prohibit focus move into background page?

2021-05-18 02-27-17
Manish Gupta
Champion

Hello Yao

The behavior is not strange because the pop-up is part of the Parent Screen. I have never tried it before but I feel you can try using JavaScript to Disable the Background. Here are some resource may help you - https://www.codegrepper.com/code-examples/javascript/how+to+disable+background+when+popup+open+in+javascript 


Thank you  

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Yao Chen ,

I agree this is strange from a UX point of view.

You can fix this by adding an onblur to the last element of your popup, bringing focus back to first programatically.

Also, I looked at bringing the focus to the first input of the popup when opening the popup.  That is a bit tougher, because at the time you flip the boolean to make popup visible, the widgets on the popup are not part of the dom yet, so can't get focus yet.

For this, I made a little helper block to fake the popup having an OnReady event. 

 In that OnReady, the inputs are part of the dom and can get focus, provided that you drop the helper block at the bottom of the popup (or at least below the input you want to focus)

Finally, I noticed that on opening the popup, there is focus, but text it not selected in the same way it is when tabbing back and forth.  I created a client action to do both the focus and pre select the text.

See attached oml for a demo

Dorine

QDR_LimitTabToPopup.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.