Skip to content

Commit 9bebdce

Browse files
authored
Merge pull request #2013 from plotly/fix-html-gen
Fix html generation
2 parents adb6db7 + 252557f commit 9bebdce

File tree

3 files changed

+41
-45
lines changed

3 files changed

+41
-45
lines changed

components/dash-html-components/scripts/data/attributes.json

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,6 @@
417417
],
418418
"description": "Indicates the upper bound of the lower range."
419419
},
420-
"manifest": {
421-
"elements": [
422-
"html"
423-
],
424-
"description": "Specifies the URL of the document's cache manifest. Note: This attribute is obsolete, use <link rel=\"manifest\"> instead."
425-
},
426420
"max": {
427421
"elements": [
428422
"input",
@@ -511,7 +505,7 @@
511505
"details",
512506
"dialog"
513507
],
514-
"description": "Indicates whether the the contents are currently visible (in the case of a <details> element) or whether the dialog is active and can be interacted with (in the case of a <dialog> element)."
508+
"description": "Indicates whether the contents are currently visible (in the case of a <details> element) or whether the dialog is active and can be interacted with (in the case of a <dialog> element)."
515509
},
516510
"optimum": {
517511
"elements": [
@@ -591,6 +585,12 @@
591585
],
592586
"description": "Indicates whether the list should be displayed in a descending order instead of a ascending."
593587
},
588+
"role": {
589+
"elements": [
590+
"Globalattribute"
591+
],
592+
"description": "Defines an explicit role for an element for use by assistive technologies."
593+
},
594594
"rows": {
595595
"elements": [
596596
"textarea"
@@ -616,12 +616,6 @@
616616
],
617617
"description": "Defines the cells that the header test (defined in the th element) relates to."
618618
},
619-
"scoped": {
620-
"elements": [
621-
"style"
622-
],
623-
"description": ""
624-
},
625619
"selected": {
626620
"elements": [
627621
"option"
@@ -714,12 +708,6 @@
714708
],
715709
"description": "Defines CSS styles which will override styles previously set."
716710
},
717-
"summary": {
718-
"elements": [
719-
"table"
720-
],
721-
"description": ""
722-
},
723711
"tabIndex": {
724712
"elements": [
725713
"Globalattribute"
@@ -852,6 +840,7 @@
852840
"hidden",
853841
"id",
854842
"lang",
843+
"role",
855844
"spellCheck",
856845
"style",
857846
"tabIndex",
@@ -1110,9 +1099,6 @@
11101099
"marquee": [
11111100
"loop"
11121101
],
1113-
"html": [
1114-
"manifest"
1115-
],
11161102
"source": [
11171103
"media",
11181104
"sizes",
@@ -1122,7 +1108,6 @@
11221108
],
11231109
"style": [
11241110
"media",
1125-
"scoped",
11261111
"type"
11271112
],
11281113
"map": [
@@ -1148,9 +1133,6 @@
11481133
"colgroup": [
11491134
"span"
11501135
],
1151-
"table": [
1152-
"summary"
1153-
],
11541136
"menu": [
11551137
"type"
11561138
],

components/dash-html-components/scripts/generate-components.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ function generatePropTypes(element, attributes) {
145145
*/
146146
'key': PropTypes.string,
147147
148-
/**
149-
* The ARIA role attribute
150-
*/
151-
'role': PropTypes.string,
152-
153148
/**
154149
* A wildcard data attribute
155150
*/

dash/testing/application_runners.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
import runpy
1313
import requests
1414

15-
from dash.testing.errors import NoAppFoundError, TestingTimeoutError, ServerCloseError
15+
from dash.testing.errors import (
16+
NoAppFoundError,
17+
TestingTimeoutError,
18+
ServerCloseError,
19+
DashAppLoadingError,
20+
)
1621
from dash.testing import wait
1722

1823

@@ -146,37 +151,51 @@ def _handle_error():
146151

147152
app.server.errorhandler(500)(_handle_error)
148153

154+
if self.thread and self.thread.is_alive():
155+
self.stop()
156+
149157
def run():
150158
app.scripts.config.serve_locally = True
151159
app.css.config.serve_locally = True
160+
161+
options = kwargs.copy()
162+
152163
if "port" not in kwargs:
153-
kwargs["port"] = self.port = BaseDashRunner._next_port
164+
options["port"] = self.port = BaseDashRunner._next_port
154165
BaseDashRunner._next_port += 1
155166
else:
156-
self.port = kwargs["port"]
167+
self.port = options["port"]
157168

158169
try:
159-
app.run_server(threaded=True, **kwargs)
170+
app.run_server(threaded=True, **options)
160171
except SystemExit:
161172
logger.info("Server stopped")
162173

163-
self.thread = KillerThread(target=run)
164-
self.thread.daemon = True
165-
try:
166-
self.thread.start()
167-
except RuntimeError: # multiple call on same thread
168-
logger.exception("threaded server failed to start")
169-
self.started = False
174+
retries = 0
170175

171-
self.started = self.thread.is_alive()
176+
while not self.started and retries < 3:
177+
try:
178+
self.thread = KillerThread(target=run)
179+
self.thread.daemon = True
180+
self.thread.start()
181+
# wait until server is able to answer http request
182+
wait.until(lambda: self.accessible(self.url), timeout=2)
183+
self.started = self.thread.is_alive()
184+
except Exception as err: # pylint: disable=broad-except
185+
logger.exception(err)
186+
self.started = False
187+
retries += 1
188+
BaseDashRunner._next_port += 1
172189

173-
# wait until server is able to answer http request
174-
wait.until(lambda: self.accessible(self.url), timeout=1)
190+
self.started = self.thread.is_alive()
191+
if not self.started:
192+
raise DashAppLoadingError("threaded server failed to start")
175193

176194
def stop(self):
177195
self.thread.kill()
178196
self.thread.join()
179197
wait.until_not(self.thread.is_alive, self.stop_timeout)
198+
self.started = False
180199

181200

182201
class ProcessRunner(BaseDashRunner):

0 commit comments

Comments
 (0)