使用内置的Chrome Lighthouse在WP网站上运行可访问性审核,由于没有关联的标签,因此注册字段无效。我以前曾遇到过这个问题,但我不明白为什么它认为它没有关联。我可以通过直接在aria-label标签上添加标签来使其通过,input但我不必这样做。
这是从Subscribe2创建的代码片段
<label for="s2email">Your email:</label>
<br>
<input type="text" name="email" id="s2email" value="Enter email address..." size="20" onfocus="if (this.value === 'Enter email address...') {this.value = '';}" onblur="if (this.value === '') {this.value = 'Enter email address...';}">
Run Code Online (Sandbox Code Playgroud)
可以在这里找到:https://blog.collaborative.org/
在访问我的单页应用程序的“重置密码”路径并查看 Chrome 浏览器控制台时,我收到以下警告:
[DOM] 密码表单应具有(可选隐藏)用户名字段以方便访问:(更多信息:goo.gl/9p2vKq)
<form class="searchAccount_form animated fadeIn form-tabular ng-pristine ng-valid ng-scope ng-hide" ng-show="isSet(6)" aria-hidden="true">
<h5>Choose a new password</h5>
<hr class="mt-0">
<p>A strong password is a combination of letters and punctuation marks. It must be at least 6 characters long.</p>
<div class="form-group row">
<label class="col-form-label col-4">New Password</label>
<div class="col-7">
<input autocomplete="new-password" class="form-control ng-pristine ng-untouched ng-valid ng-empty" type="password" ng-model="$parent.new_pass" name="password" ng-attr-type="{{ showPassword ? 'text':'password'}}" aria-invalid="false">
</div>
</div>
<div class="form-group">
<input type="hidden" name="username" value="craig.francis" autocomplete="off" readonly="readonly">
<input type="hidden" name="csrf" value="tr6Gj6w6LczH98" autocomplete="off"> …Run Code Online (Sandbox Code Playgroud)我已经设置了一个带有 firebase 电子邮件和密码登录的身份验证防护,问题是它会自动触发到指定组件的路由。
我已经实现了身份验证保护并将其设置在正确的模块提供程序中(因为我的应用程序中有很多提供程序)。这是我的身份验证服务:
import { Injectable } from '@angular/core';
import { Router, Route ,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild, CanLoad } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { SimpleAuthService } from './simple-auth.service';
@Injectable()
export class AuthGuard implements CanActivate, CanActivateChild, CanLoad {
constructor(private authService: SimpleAuthService) { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
const url: string = state.url;
return this.checkLogin(url);
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return this.canActivate(route, state);
}
canLoad(route: Route): Observable<boolean> {
const url: string = …Run Code Online (Sandbox Code Playgroud)