fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Tag Picker wipes out input text when Left arrow key is pressed

Open chuanqisun opened this issue 5 years ago • 7 comments

Environment Information

  • Package version(s): 8.41.2
  • Browser and OS versions: Edge 95.0.1020.44 on Windows 11

Please provide a reproduction of the bug in a codepen:

https://codepen.io/chuanqisun/pen/MWvGqzg

The bug repro was exported directly from the official component demo page, as of Nov. 8 2021, without any modification https://developer.microsoft.com/en-us/fluentui#/controls/web/pickers

Actual behavior:

After typing in pinkk, I press Left, and entire input is emptied. Screen recording

Expected behavior:

After typing in pinkk, press Left should move the cursor to the position between the first k and the second k

Priorities and help requested:

Are you willing to submit a PR to fix? (depending on initial investigation)

Requested priority: (High)

Products/sites affected: (hits.microsoft.com)

chuanqisun avatar Nov 08 '21 19:11 chuanqisun

@khmakoto, could you help us triage this bug?

chuanqisun avatar Nov 29 '21 21:11 chuanqisun

@chuanqisun -Thanks for filing this issue with us. To set expectations, the developers will review this issue once capacity allows.

@layershifter - Would you be able to confirm if this is a regression, or if this behavior is an issue?

gouttierre avatar Dec 14 '21 15:12 gouttierre

This is clearly a regression in v8, I created CodeSandbox with earliest stable version (@fluentui/[email protected]): https://codesandbox.io/s/stoic-matsumoto-1v1px?file=/src/App.tsx. I can repro it there, but on v7 it works fine.

Looking into it to get more details.

layershifter avatar Dec 15 '21 13:12 layershifter

The problem happens in this handler:

image

That matches following in source code:

https://github.com/microsoft/fluentui/blob/c88ab7e4b2ba6ebadce68d569c6922cb1b0cd5f6/packages/react/src/components/Autofill/Autofill.tsx#L240-L245

I traced it and the change happened in #15227, before it was the same as in v7 🤔

image


The change that happened in #15227 does not seem correct to me, but I don't have enough context to propose the fix. @gouttierre would you mind to assign it to someone who works on v8 to fix it?

layershifter avatar Dec 15 '21 15:12 layershifter

Following up on this issue, is there an update on when there will be a fix released?

Trish92 avatar Jan 05 '22 21:01 Trish92

Upon adding a debugger in the Basepicker, I see that there is no switch case for keyCodes for left or right arrow key

 _this.onKeyDown = function (ev) {
            // eslint-disable-next-line deprecation/deprecation
            var keyCode = ev.which;
            switch (keyCode) {
                case KeyCodes.escape:
                    if (_this.state.suggestionsVisible) {
                        _this.setState({ suggestionsVisible: false });
                        ev.preventDefault();
                        ev.stopPropagation();
                    }
                    break;
                case KeyCodes.tab:
                case KeyCodes.enter:

Trish92 avatar Jan 07 '22 20:01 Trish92

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

msft-fluent-ui-bot avatar Jul 11 '22 22:07 msft-fluent-ui-bot