components icon indicating copy to clipboard operation
components copied to clipboard

bug(COMPONENT): Table is sorted on press SPACE or ENTER

Open sashko687 opened this issue 5 months ago • 1 comments

Is this a regression?

  • [X] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.1.2

Description

Since MatSortHeader listens keydowm event and _handleKeydown($event) method toggle sort on focused column it makes both confusing users and side effect on rest Angular application. Prease, either provide Input for disabling toggle sorting on defined column or remove this listening event at all

@Component({ selector: '[mat-sort-header]', exportAs: 'matSortHeader', templateUrl: 'sort-header.html', styleUrl: 'sort-header.css', host: { 'class': 'mat-sort-header', '(click)': '_handleClick()', '(keydown)': '_handleKeydown($event)', '(mouseenter)': '_setIndicatorHintVisible(true)', '(mouseleave)': '_setIndicatorHintVisible(false)', '[attr.aria-sort]': '_getAriaSortAttribute()', '[class.mat-sort-header-disabled]': '_isDisabled()', }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [ matSortAnimations.indicator, matSortAnimations.leftPointer, matSortAnimations.rightPointer, matSortAnimations.arrowOpacity, matSortAnimations.arrowPosition, matSortAnimations.allowChildren, ], standalone: true, }) export class MatSortHeader implements MatSortable, OnDestroy, OnInit, AfterViewInit {

Reproduction

StackBlitz link: Steps to reproduce: 1. 2.

Expected Behavior

Table won't be sorted on press SPACE or ENTER

Actual Behavior

Table is sorted on press SPACE or ENTER

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

sashko687 avatar Sep 17 '24 12:09 sashko687