ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
128 stars 85 forks source link

Popover auto dismiss focus of active element by default #61

Open ionitron-bot[bot] opened 5 years ago

ionitron-bot[bot] commented 5 years ago

Ionic version: (check one with "x") [ ] 1.x [x] 2.x

I'm submitting a ... (check one with "x") [ ] bug report [x] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: When opening a popover from PopoverController, the default behavior is to automatically blur any focused element. Sometimes, it is not a wanted behavior.

Expected behavior: An option should be available to tell the PopoverCmp if we want to dismiss automatically focus or not.

Steps to reproduce: A typical use-case, is opening a popover when the user focus an input field. The popover is showing extra-information related to the user input and should be dismissed when the input field focus is removed. In this situation, we want to keep the focus in the input field (unless the user explicitly change the focus).

Other information: I was able to 'patch' the PopoverCmp in a hackish way to accomplish what I wanted (getting rid of the code disabling active focus):

let popover = popoverCtrl.create(...);

popover.component.prototype.ionViewPreLoad = function() { this._load(this._navParams.data.component); };

But a dedicated option 'dontBlurFocus' would be much better/safer on the long run (defaulting to false, so the default behavior would be the same as now).

BAYiTUPAi commented 2 years ago

I'm looking for this feature too. Trying to create a popover that functions similarly to stackoverflows "tag" selection. It's working perfectly except for the blur / darkened background whenever the popover is displayed.