我遇到了一个我确实无法解决的问题!当我在开发模式下运行我的angular 7项目时(使用ng服务),我可以使用Tab键浏览页面(窗体,链接,按钮等)。当我运行ng serve --prod并在本地(localhost)运行项目时,选项卡导航也有效。但是奇怪的是,当我将生产版本放入服务器时,Tab键停止工作。
我要离开我的angular.json文件,因为我最好的镜头是此问题与某些配置有关(只是不知道是哪个配置)
我已经在Google上搜索了一次,但是找不到任何相关的信息...
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Marketplace": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
{
"glob": "**/*",
"input": "src/assets/ubrest",
"output": "assets"
},
"src/assets/ubrest/favicon.ico",
"src/.htaccess"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/summernote/dist/summernote-lite.css",
"node_modules/owl.carousel/dist/assets/owl.carousel.css",
"node_modules/owl.carousel/dist/assets/owl.theme.default.css",
"node_modules/fullpage.js/dist/jquery.fullpage.css",
"src/assets/ubrest/sass/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": [
"src/assets/ubrest/sass"
]
},
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/summernote/dist/summernote-lite.js",
"node_modules/owl.carousel/dist/owl.carousel.min.js",
"node_modules/fullpage.js/dist/jquery.fullpage.min.js",
"node_modules/fullpage.js/dist/jquery.fullpage.extensions.min.js"
]
},
"configurations": {
"production": {
"optimization": false,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Marketplace:build",
"port": 8080
},
"configurations": {
"production": {
"browserTarget": "Marketplace:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Marketplace:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
"src/assets/sass/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"Marketplace-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "Rhizom Marketplace:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "Marketplace",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
谢谢!
答案 0 :(得分:1)
我可以看到您正在使用fullPage.js。 该库将覆盖制表符功能,以便在某些情况下保持正确的布局。
为了测试这是否是您的问题,可以尝试在控制台上致电:
$.fn.fullpage.destroy();
这将破坏fullPage.js使用的所有JS处理程序,但将保留整个页面的结构。
真正没有意义的是,您仅在生产中遇到问题,而在开发中则没有问题。
无论如何,我建议您将fullpage.js版本更新为最新版本。 Fullpage.js3.X。如您在其changelog中所见,它摆脱了jQuery并解决了选项卡功能的某些问题。
另外,请注意,您只需要包含一次fullPage.js,然后重复执行两次,这可能会导致问题:
"node_modules/fullpage.js/dist/jquery.fullpage.min.js",
"node_modules/fullpage.js/dist/jquery.fullpage.extensions.min.js"
仅使用一个扩展名。
答案 1 :(得分:0)
这很奇怪。我们拥有以现代角度构建的应用程序,但是在任何可访问性审核中都从未遇到过这个问题。您是否看过标签索引?如果您使用的是自定义组件,则可能需要将tabindex =“ 0”分配给那些应该具有键盘焦点的元素。