Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Textfield doesn't get focus when the user clicks it directly on the placeholder text #142

Closed
Rick-Kirkham opened this issue Oct 4, 2016 · 0 comments
Labels

Comments

@Rick-Kirkham
Copy link
Contributor

Rick-Kirkham commented Oct 4, 2016

In TextField.ts, the _addListeners() method needs to be changed to add the code below that is either bolder or between two pairs of asterisks depending on whether Markdown syntax is working on GitHub today). Without this, the text field doesn't get focus when the user clicks it directly on the placeholder text.

if (this._type.indexOf(TextFieldConsts.Type.Placeholder) >= 0) {
        this._textField.addEventListener("focus", (event: MouseEvent) => {
          this._textFieldLabel.style.display = "none";
        });
    **// Ensure that the text box gets focus when the placeholder text itself is clicked.
        this._textFieldLabel.addEventListener("click", (event: MouseEvent) => {
          this._textField.focus();
        });**
        this._textField.addEventListener("blur", (event: MouseEvent) => {
          // Show only if no value in the text field
          if (this._textField.value.length === 0) {
            this._textFieldLabel.style.display = "block";
          }
        });
      }

Sorry, I can't make pull request because when I try to fork this repo, I get an erroneous message saying that I've already forked it.

@ericthompson ericthompson changed the title bug fix Textfield doesn't get focus when the user clicks it directly on the placeholder text Oct 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants