从 Ionic 4 上的 <ion-footer> 中删除(或替换)role="contentinfo"

Remove (or replace) role="contentinfo" from <ion-footer> on Ionic 4

我在 Ionic4 上使用 <ion-footer> 标签将内容放在页面底部:https://ionicframework.com/docs/api/footer

Ionic 自动在 <ion-footer> 标签上添加 role="contentinfo" 属性。

The contentinfo landmark role is used to identify information repeated at the end of every page of a website, including copyright information, navigation links, and privacy statements (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Contentinfo_role)

在我的例子中,我没有使用 <ion-footer> 来重复显示信息,因此为了更易于访问,我想删除此属性,或将其替换为 role="presentation"

是否可以更改 <ion-footer> 标签上此属性的值?

感谢您的帮助。

<ion-footer> is a root component that sits at the bottom of the page.

直接来自文档。

<ion-footer> 将自己暴露为 HTML 中的 <footer> 元素,因此除文章或文档页脚之外的任何其他用例在语义上都是不正确的,只是换掉了 role 无济于事。

您应该改为创建自定义组件,或者如果您有其他用例,则寻找替代组件。

您显然可以给组件自定义 class 并根据需要设置样式,但要确保组件在语义上是正确的。