Triptych Project开发者提议为HTML的button元素添加action和method属性,以明确区分按钮和链接在网页中的不同语义含义 1。按钮代表动作,在固定上下文中执行;而链接代表目的地,允许用户控制打开方式,如中键点击或在新标签页打开 1。
当前网页开发中存在语义混用的问题 1。开发者在实现状态转换导航时,常不正确地使用链接呈现为按钮样式,违反了HTML的语义规范 1。美国Web设计系统(USWDS)提供的class="usa-button"虽能将链接伪装成按钮的视觉样式,但无法实现真正的按钮行为 1。这一限制对无JavaScript网站构成挑战,例如英国政府网站等项目目前只能依赖链接实现导航功能 1。Button Actions提案旨在通过标准化属性设计,为网页无脚本实现和无障碍访问提供价值,其中DELETE请求是最常见的使用场景 1。
Developers are advancing a proposal within the Triptych Project to standardize how buttons and links function in HTML by introducing new action and method attributes to the button element 1. The initiative aims to clarify the semantic distinction between buttons, which represent actions to be performed, and links, which represent destinations users can navigate to 1.
Currently, the lack of native button functionality for navigation tasks has led developers to misuse links styled as buttons, compromising HTML semantics 1. Websites without JavaScript—including government sites like those in the United Kingdom—must rely solely on links to implement navigation, despite buttons being the more appropriate semantic choice for such interactions 1. The U.S. Web Design System offers a workaround through the class="usa-button" convention to visually transform links into buttons, but this approach cannot deliver genuine button behavior 1.
The proposed feature addresses practical use cases where buttons would traditionally require scripting to function, with DELETE requests cited as among the most common scenarios requiring this capability 1. By enabling buttons to specify actions and methods directly in HTML, the proposal would support both semantic correctness and accessibility improvements, while also enabling truly no-script implementations of interactive features 1.
评论
还没有评论,欢迎留下第一条。