wx.html2.WebView accessibility with screen readers

Hi,

In wxPython 4.0 Phoenix, I'm trying to use wx.html2.WebView with a screen reader.

Whether with JAWS or NVDA, I have to make a left mouse click on the WebView to be able to see my page in an accessible Web interface, ('Internet Explorer_Server').

Here is my code using the SetPage method, but know that I'm having the same problem with LoadURL.

You'll find in attachment, an other code that uses the user32.mouse_event to simulate the left click once the WevView is displayed.

This attached code works perfectly, but it would be better if the Internet Explorer_Server page is opened without having to make this click, would it be possible to integrate this into a method of the wx.html2.WevView class?

Thank you in advance for your answers.

import wx
import wx.html2

class MyWebView (wx.Dialog):

 def \_\_init\_\_\(self, parent\):
     wx\.Dialog\.\_\_init\_\_\(self, parent\)
     sizer = wx\.BoxSizer\(wx\.VERTICAL\)
     self\.browser = wx\.html2\.WebView\.New\(self\)
     self\.changeBtn = wx\.Button \(self, \-1, label="Change page"\)

     \# The pages that I want to display disposed in a tuple\.
     self\.pages = \(
     "<html><head><title>Hello everyone \!</title></head><body><h1>We're testing wx\.html2\.WebView with a Screen Reader \!</h1></body></html>",
     "<html><head><title>Second page \!</title></head><body><h1>This is a second page</h1></body></html>",
     "<html><head><title>Third page \!</title></head><body><h1>This is a third page</h1></body></html>"
     \)

     self\.index = 0
     self\.display = self\.pages\[self\.index\]
     sizer\.Add\(self\.browser, 1, wx\.EXPAND, 10\)
     sizer\.Add\(self\.changeBtn\)
     self\.SetSizer\(sizer\)
     self\.SetSize\(\(700, 700\)\)

 \# Events\.
     self\.changeBtn\.Bind \(wx\.EVT\_BUTTON, self\.onChangePage\)

 def onChangePage \(self, evt\):
     self\.index \+= 1
     if self\.index == len \(self\.pages\):
         self\.index = 0
     self\.display = self\.pages\[self\.index\]
     self\.browser\.SetPage\(self\.display, ""\)

if __name__ == '__main__':
app = wx.App()
dialog = MyWebView (None)
dialog.browser.SetPage(dialog.display, "")
dialog.Show ()
app.MainLoop()

Kind regards,
Abdel.

testHtml2WebView.py (1.82 KB)