bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Request "open-on-focus" attribute on datepicker-popup.

Open OlmoAcerta opened this issue 12 years ago • 15 comments

After upgrading to 0.11 our datepicker popups no longer work as expected. I've asked around on IRC and came to the conclusion that there are very good reasons for this (w.r.t. accessibility).

Nevertheless, the guys from business prefer the old behavior. As they are the end-user, there is little I can do to convince them that the current behavior is fine.

As a compromise I propose an "open-on-focus" attribute, which could be put on datepicker-popups to re-enable the old behavior. A note should be made in the documentation to explain the accessibility issues involved.

Thank you.

OlmoAcerta avatar Jun 06 '14 13:06 OlmoAcerta

+1

JustMaier avatar Jun 18 '14 03:06 JustMaier

Can somebody please explain this good reasons?

Btw. this is working fine for me:

<input datepicker-popup is-open="focus" ng-focus="focus=true" />

svestka avatar Jun 25 '14 14:06 svestka

+1

clicktravel-martin avatar Jun 27 '14 11:06 clicktravel-martin

+1

Kevlys avatar Aug 05 '14 15:08 Kevlys

I have an error (̀$apply already in progress) in the console with @peterslivka solution, see #2548.

Maybe I'm doing something wrong ?

Kevlys avatar Aug 06 '14 08:08 Kevlys

I'm seeing the same error as Kevlys when using either data-ng-focus="..." or data-ng-blur="..."

samuelms1 avatar Sep 20 '14 06:09 samuelms1

One quick solution to the $apply already in progress error is to instead point the ng-focus event to a function in the controller, and then use a $timeout to set the isOpen value (in this example - focus)

On the controller:

$scope.openDate = function ($event) {
    $event.preventDefault();
    $event.stopPropagation();

    $timeout(function() {
        $scope.focus = true;
    });
};

And then the element becomes:

<input datepicker-popup is-open="focus" ng-focus="openDate($event)" />

mgoodfellow avatar Dec 12 '14 21:12 mgoodfellow

+1

jwanglof avatar Apr 07 '15 15:04 jwanglof

+1

arjunasuresh3 avatar Apr 27 '15 06:04 arjunasuresh3

+1

artdias90 avatar Apr 27 '15 10:04 artdias90

What's the status regarding closing datepicker on blur?

artdias90 avatar Jun 14 '15 22:06 artdias90

+1

sistemanick avatar Jul 08 '15 05:07 sistemanick

looks like onOpenFocus doesn't work http://plnkr.co/edit/s15jAd1hEEI94dCeC42I?p=preview

bademux avatar Oct 22 '15 14:10 bademux

@bademux, please do not comment on old and closed issues. Doing so is a really good way for us to miss it.

If you think you've found a bug, please follow these instructions.

Unfortunately, if you think you have found a bug and do not follow the above instructions within a reasonable amount of time, we will close the issue due to lack of activity.

icfantv avatar Oct 22 '15 15:10 icfantv

@icfantv Can you please re-open this?

https://github.com/angular-ui/bootstrap/commit/68afc4c63e791e86de7fe59be9bc8fb7e68243f6 should not have closed this as that adds on-open-focus and not the proposed open-on-focus as outlined in this issue. The former allows for "disabling of focus of popup after datepicker popup is opened" while the later would allow for the previous behavior on input elements (where focusing would open the popup).

Presently, the best solution is as @peterslivka said: <input datepicker-popup is-open="focus" ng-focus="focus=true" /> which is gross o_O.

WesleyKapow avatar May 15 '17 20:05 WesleyKapow