Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

uibDatePicker focuses the grid of buttons after being popped up, which doesn't include the button bar at the bottom #6133

Open
@rsc092020

Description

@rsc092020

Bug description:

When opening uibDatepicker through uibDatepickerPopup, this code gets called:

var focusElement = function() {
    self.element[0].focus();
};

because of this event listener:

// Listen for focus requests from popup directive
$scope.$on('uib:datepicker.focus', focusElement);

This will focus the table that surrounds all of the buttons for each day, or month, or year, depending on which picker is showing (because it is the root element for each picker). It seems to me that the element that contains the table plus the button bar at the bottom should be focused instead so that way the whole thing gets scrolled into view, when it gets opened. It is noticeable when using the popup-placement="bottom" or popup-placement="bottom-left" or popup-placement="bottom-right" and the input is near the bottom of the page, since the button bar is below the table.

An easy workaround is just to not use the bottom placements, but I also feel like this behavior can be easily changed too, to work the same for all placements.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/ZiszhdYfbZt8UvC2MT5y?p=info

As you can see, when the datepicker gets opened at the bottom of the page, the button bar below it is still out of view.

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.5

UIBS: 1.3.2
(this is the version I'm using and the version in the plunkr, but the behavior is the same in 2.0.0)

Bootstrap: 3.3.6

More info

I have some code that I could potentially use in a PR that would instead focus the outer ul element (which would be a parent of the picker and button bar), but I'm not yet sure whether this is a bug or is as designed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions