1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Browser: Add Accessibility Tab to Inspector Widget

This tab allows you to view the accessibility tree like you do
the DOM tree. The implementation limited to the role currently,
once we add the name and description calculation algorithm, those
will be displayed here as well. Selections are also not currently
supported.
This commit is contained in:
Jonah 2022-12-28 17:26:23 -06:00 committed by Sam Atkins
parent 367b1634fd
commit e361025cfb
6 changed files with 203 additions and 1 deletions

View file

@ -244,8 +244,10 @@ Tab::Tab(BrowserWindow& window)
update_status();
if (m_dom_inspector_widget)
if (m_dom_inspector_widget) {
m_web_content_view->inspect_dom_tree();
m_web_content_view->inspect_accessibility_tree();
}
};
view().on_navigate_back = [this]() {
@ -421,6 +423,11 @@ Tab::Tab(BrowserWindow& window)
m_dom_inspector_widget->set_dom_node_properties_json({ node_id }, specified, computed, custom_properties, node_box_sizing);
};
view().on_get_accessibility_tree = [this](auto& accessibility_tree) {
if (m_dom_inspector_widget)
m_dom_inspector_widget->set_accessibility_json(accessibility_tree);
};
view().on_js_console_new_message = [this](auto message_index) {
if (m_console_widget)
m_console_widget->notify_about_new_console_message(message_index);
@ -666,6 +673,7 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target)
m_dom_inspector_widget = window->set_main_widget<InspectorWidget>().release_value_but_fixme_should_propagate_errors();
m_dom_inspector_widget->set_web_view(*m_web_content_view);
m_web_content_view->inspect_dom_tree();
m_web_content_view->inspect_accessibility_tree();
}
if (inspector_target == InspectorTarget::HoveredElement) {