feat: add "accessibleTitle" property to a BrowserWindow instance (#19698)

Sometimes it's necessary to convey more information about the window to screen reader users only (simply putting everything to the window title might be unnecessarily noisy).

For example, Chromium uses that technique to tell screen reader users that the window is in incognito mode (the incognito window looks differently and doesn't have «incognito» in the title, but for blind users the screen reader will announce that it's incognito).
This commit is contained in:
Marat Abdullin 2019-08-28 00:35:34 +02:00 committed by Alexey Kuzmin
parent 1dcda7b809
commit ae9424d93a
5 changed files with 46 additions and 0 deletions

View file

@ -575,6 +575,14 @@ std::string TopLevelWindow::GetTitle() {
return window_->GetTitle();
}
void TopLevelWindow::SetAccessibleTitle(const std::string& title) {
window_->SetAccessibleTitle(title);
}
std::string TopLevelWindow::GetAccessibleTitle() {
return window_->GetAccessibleTitle();
}
void TopLevelWindow::FlashFrame(bool flash) {
window_->FlashFrame(flash);
}
@ -1124,6 +1132,8 @@ void TopLevelWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("getPosition", &TopLevelWindow::GetPosition)
.SetMethod("setTitle", &TopLevelWindow::SetTitle)
.SetMethod("getTitle", &TopLevelWindow::GetTitle)
.SetProperty("accessibleTitle", &TopLevelWindow::GetAccessibleTitle,
&TopLevelWindow::SetAccessibleTitle)
.SetMethod("flashFrame", &TopLevelWindow::FlashFrame)
.SetMethod("setSkipTaskbar", &TopLevelWindow::SetSkipTaskbar)
.SetMethod("setSimpleFullScreen", &TopLevelWindow::SetSimpleFullScreen)