In general, we recommend only adding (click)
events to elements that
are normally clickable. This includes <button>
and <a>
elements.
This improves accessibility as a screen reader will be able to tell that the element is clickable.
However, you may need to add a
(click)
event
to an element that is not normally clickable. When you do this you may experience a 300ms
delay
from the time you click the element to the event firing. To remove this delay, you can add the tappable
attribute
to your element.<div
tappable (click)="doClick()">I
am clickable!</div>
一般來說,我們建議您只向通常可點擊的元素添加(點擊)事件。 這包括<button>和<a>元素。 這提高了可訪問性,因爲屏幕閱讀器將能夠告訴該元素是可點擊的。
但是,您可能需要向通常不可點擊的元素添加(點擊)事件。 執行此操作時,您可能會遇到從點擊元素到事件觸發的300毫秒延遲。 要刪除此延遲,可以將tappable屬性添加到元素。