diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe4557c8256..fa32a7b6593 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,12 +2,17 @@
 All notable changes to this project will be documented in this file.
 This project adheres to [Semantic Versioning](http://semver.org/).
 
+
 ## UNRELEASED
 
 ### Added
 
   - `pattern_shape` options now available in `px.timeline()`
 
+### Updated
+
+  - Allow non-string extras in `flaglist` attributes, to support upcoming changes to `ax.automargin` in plotly.js [plotly.js#6193](https://github.com/plotly/plotly.js/pull/6193), [#3749](https://github.com/plotly/plotly.py/pull/3749)
+
 ## [5.8.2] - 2022-06-10
 
 ### Fixed
@@ -18,7 +23,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 (no changes, due to a mixup with the build process!)
 
-
 ## [5.8.0] - 2022-05-09
 
 ### Fixed
diff --git a/packages/python/plotly/_plotly_utils/basevalidators.py b/packages/python/plotly/_plotly_utils/basevalidators.py
index 98b9df2e5ae..f68bc63f761 100644
--- a/packages/python/plotly/_plotly_utils/basevalidators.py
+++ b/packages/python/plotly/_plotly_utils/basevalidators.py
@@ -1795,8 +1795,6 @@ def __init__(
         self.extras = extras if extras is not None else []
         self.array_ok = array_ok
 
-        self.all_flags = self.flags + self.extras
-
     def description(self):
 
         desc = (
@@ -1835,24 +1833,21 @@ def description(self):
         return desc
 
     def vc_scalar(self, v):
+        if isinstance(v, str):
+            v = v.strip()
+
+        if v in self.extras:
+            return v
+
         if not isinstance(v, str):
             return None
 
         # To be generous we accept flags separated on plus ('+'),
-        # or comma (',')
+        # or comma (',') and we accept whitespace around the flags
         split_vals = [e.strip() for e in re.split("[,+]", v)]
 
         # Are all flags valid names?
-        all_flags_valid = all([f in self.all_flags for f in split_vals])
-
-        # Are any 'extras' flags present?
-        has_extras = any([f in self.extras for f in split_vals])
-
-        # For flaglist to be valid all flags must be valid, and if we have
-        # any extras present, there must be only one flag (the single extras
-        # flag)
-        is_valid = all_flags_valid and (not has_extras or len(split_vals) == 1)
-        if is_valid:
+        if all(f in self.flags for f in split_vals):
             return "+".join(split_vals)
         else:
             return None
diff --git a/packages/python/plotly/_plotly_utils/tests/validators/test_flaglist_validator.py b/packages/python/plotly/_plotly_utils/tests/validators/test_flaglist_validator.py
index 157b98d9754..4ce30022dac 100644
--- a/packages/python/plotly/_plotly_utils/tests/validators/test_flaglist_validator.py
+++ b/packages/python/plotly/_plotly_utils/tests/validators/test_flaglist_validator.py
@@ -4,21 +4,20 @@
 import numpy as np
 
 
+EXTRAS = ["none", "all", True, False, 3]
+FLAGS = ["lines", "markers", "text"]
+
 # Fixtures
 # --------
-@pytest.fixture(params=[None, ["none", "all"]])
+@pytest.fixture(params=[None, EXTRAS])
 def validator(request):
     # Validator with or without extras
-    return FlaglistValidator(
-        "prop", "parent", flags=["lines", "markers", "text"], extras=request.param
-    )
+    return FlaglistValidator("prop", "parent", flags=FLAGS, extras=request.param)
 
 
 @pytest.fixture()
 def validator_extra():
-    return FlaglistValidator(
-        "prop", "parent", flags=["lines", "markers", "text"], extras=["none", "all"]
-    )
+    return FlaglistValidator("prop", "parent", flags=FLAGS, extras=EXTRAS)
 
 
 @pytest.fixture()
@@ -26,8 +25,8 @@ def validator_extra_aok():
     return FlaglistValidator(
         "prop",
         "parent",
-        flags=["lines", "markers", "text"],
-        extras=["none", "all"],
+        flags=FLAGS,
+        extras=EXTRAS,
         array_ok=True,
     )
 
@@ -35,15 +34,15 @@ def validator_extra_aok():
 @pytest.fixture(
     params=[
         "+".join(p)
-        for i in range(1, 4)
-        for p in itertools.permutations(["lines", "markers", "text"], i)
+        for i in range(1, len(FLAGS) + 1)
+        for p in itertools.permutations(FLAGS, i)
     ]
 )
 def flaglist(request):
     return request.param
 
 
-@pytest.fixture(params=["none", "all"])
+@pytest.fixture(params=EXTRAS)
 def extra(request):
     return request.param
 
@@ -69,7 +68,7 @@ def test_coercion(in_val, coerce_val, validator):
 
 
 # ### Rejection by type ###
-@pytest.mark.parametrize("val", [21, (), ["lines"], set(), {}])
+@pytest.mark.parametrize("val", [(), ["lines"], set(), {}])
 def test_rejection_type(val, validator):
     with pytest.raises(ValueError) as validation_failure:
         validator.validate_coerce(val)
@@ -79,7 +78,7 @@ def test_rejection_type(val, validator):
 
 # ### Rejection by value ###
 @pytest.mark.parametrize(
-    "val", ["", "line", "markers+line", "lin es", "lin es+markers"]
+    "val", ["", "line", "markers+line", "lin es", "lin es+markers", 21]
 )
 def test_rejection_val(val, validator):
     with pytest.raises(ValueError) as validation_failure:
@@ -144,7 +143,7 @@ def test_acceptance_aok_scalarlist_flaglist(flaglist, validator_extra_aok):
     [
         ["all", "markers", "text+markers"],
         ["lines", "lines+markers", "markers+lines+text"],
-        ["all", "all", "lines+text", "none"],
+        ["all", "all", "lines+text"] + EXTRAS,
     ],
 )
 def test_acceptance_aok_list_flaglist(val, validator_extra_aok):
@@ -158,8 +157,8 @@ def test_acceptance_aok_list_flaglist(val, validator_extra_aok):
     "in_val,expected",
     [
         (
-            ["  lines ", " lines + markers ", "lines ,markers"],
-            ["lines", "lines+markers", "lines+markers"],
+            ["  lines ", " lines + markers ", "lines ,markers", "  all  "],
+            ["lines", "lines+markers", "lines+markers", "all"],
         ),
         (np.array(["text   +lines"]), np.array(["text+lines"], dtype="unicode")),
     ],
diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py
index 7ce054aab89..7567cf81569 100644
--- a/packages/python/plotly/setup.py
+++ b/packages/python/plotly/setup.py
@@ -286,7 +286,7 @@ def get_latest_publish_build_info(repo, branch):
 
     url = (
         r"https://circleci.com/api/v1.1/project/github/"
-        r"{repo}/tree/{branch}?limit=10000\&filter=completed"
+        r"{repo}/tree/{branch}?limit=100&filter=completed"
     ).format(repo=repo, branch=branch)
 
     branch_jobs = request_json(url)