public void dropDown() { if (dropDownElement != null) { return; } dropDownElement = HTMLDocument.current().createElement("div"); dropDownElement.setAttribute("class", "flavour-dropdown flavour-dropdown-calendar"); TextRectangle windowRect = HTMLDocument.current().getBody().getBoundingClientRect(); TextRectangle inputRect = target.getElement().getBoundingClientRect(); dropDownElement.getStyle().setProperty("right", windowRect.getWidth() - inputRect.getRight() + "px"); dropDownElement.getStyle().setProperty("top", inputRect.getBottom() + "px"); CalendarDropDown dropDown = new CalendarDropDown(this::parseValue, newValue -> { closeDropDown(); target.updateValue(cachedFormatObject.format(newValue)); }); dropDownComponent = Templates.bind(dropDown, dropDownElement); HTMLDocument.current().getBody().appendChild(dropDownElement); Window.setTimeout(() -> HTMLDocument.current().addEventListener("click", bodyListener), 0); }