question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unintentional autofocus when using cdkTextareaAutosize

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Textarea should not autofocus.

What is the current behavior?

Textarea get’s autofocus when using cdkTextareaAutosize.

What are the steps to reproduce?

~~https://stackblitz.com/edit/angular-rtrc1b~~

EDIT Please see https://github.com/angular/material2/issues/11308#issuecomment-389446082

Simple debug in an iOS Simulator or on a real device using Mobile Safari. Add / Remove the cdkTextareaAutosize Directive, then reload to reproduce.

What is the use-case or motivation for changing an existing behavior?

Using pristine is no longer really an option because cdkTextareaAutosize breaks this for Mobile Safari. While the textarea is gaining autofocus the virtual keyboard does not pop up even thought there’s visual feedback that the textarea is having focus. It’s really a weird user experience and should get fixed.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

  • Angular: 6.0.0
  • Material: 6.0.1
  • OS: iOS 11.3.1
  • TypeScript: ? (Stackblitz)
  • Browsers: Mobile Safari

Is there anything else we should know?

I’ve attached screenshots of the expected behavior and the actual behavior.

Expected Behavior Actual Behavior
simulator screen shot - iphone x - 2018-05-13 at 19 43 54 simulator screen shot - iphone x - 2018-05-13 at 19 44 06

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pfeiglcommented, May 22, 2018

Thanks, just gave it a try and can reproduce with the following simple code:

<textarea id="box"></textarea>

<script type="text/javascript">
    var textarea = document.getElementById("box");
    textarea.setSelectionRange(0, 0);
</script>

which is pretty much what is happening internally

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 13 in Depth - Sébastien Dubois
Use cdkTextareaAutosize from the @angular/cdk/text-field module instead. MatTabHarness.getHarnessLoaderForContent has been removed. Use ...
Read more >
How to set autofocus on a matInput element on click event in ...
I am declaring @ViewChild('passwordInput') before constructor and using it in the changeView() when called. like this. changeView(){ this.
Read more >
angular/material - UNPKG
n *\n * Use of this source code is governed by an MIT-style license that ... if the\n // pane was closed, in...
Read more >
Risk Assessment - Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >
components: CHANGELOG.md - Fossies
Use cdkTextareaAutosize from the @angular/cdk/text-field module instead. ... fix(material-experimental/mdc-list): fix secondary line accidentally wrapping ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found