Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Check if html th is on focus
#1
I want to find out wether my HTML Event is on focus (not if it is clicked but focused by navigating with the keyboard).
Code:
myElement === document.activeElement
is only true when the element is clicked but not when it's focused by keyboard navigation.
Code:
    tooltip(){
  var myElement = document.getElementById("myID");
  let myEvent = "";
  if (myElement=== document.activeElement){
     myEvent = "focus";
  }

return myEvent;
};



<th id="myID" *ngSwitchCase="'validation'" tooltipEvent={{tooltip()}} pTooltip="I am a tooltip"
          tooltipPosition="top" [escape]="false"   [pSortableColumn]="column.field" [ngStyle]="column.style">
            <div class="col-title">
            <span data-testid="column-validationl-header" class="ui-column-title" >Validation </span>
              <p-sortIcon [field]="column.field" *ngIf="column.sortable"></p-sortIcon>
            </div>
          </th>
any Ideas?
Zitieren


Nachrichten in diesem Thema
Check if html th is on focus - von opti13403 - 27.09.2022, 09:14
RE: Check if html th is on focus - von rzscout - 28.09.2022, 09:40

Gehe zu:


Benutzer, die gerade dieses Thema anschauen:
1 Gast/Gäste