|
1 | 1 | import React, { useEffect } from 'react';
|
2 | 2 | import { JSONTree } from 'react-json-tree'; // React JSON Viewer Component;
|
3 |
| -import { setCurrentTabInApp } from '../../slices/mainSlice'; |
| 3 | +import { setCurrentTabInApp, toggleAxTree } from '../../slices/mainSlice'; |
4 | 4 | import { useDispatch } from 'react-redux';
|
5 | 5 |
|
6 | 6 | const theme = {
|
@@ -34,22 +34,40 @@ const AxTree = (props) => {
|
34 | 34 |
|
35 | 35 | const dispatch = useDispatch();
|
36 | 36 |
|
37 |
| - useEffect(() => { |
38 |
| - dispatch(setCurrentTabInApp('AxTree')); // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'tree' to facilitate render. |
39 |
| - }, []); |
| 37 | + let AccessibilityHasBeenDisabled = true; |
| 38 | + const enableAxTreeButton = () => { |
| 39 | + dispatch(toggleAxTree('toggleAxRecord')); |
| 40 | + dispatch(setCurrentTabInApp('AxTree')); |
| 41 | + AccessibilityHasBeenDisabled = false; |
| 42 | + } |
| 43 | + |
40 | 44 |
|
41 |
| - //removing/adding snapshot at beginning of return statement didn't change anything |
42 | 45 | return (
|
43 |
| - <> |
44 |
| - {' '} |
45 |
| - {snapshot && ( |
| 46 | + <div> |
| 47 | + { |
| 48 | + AccessibilityHasBeenDisabled ? <button onClick={enableAxTreeButton}>Click Here to Enable Accessibility</button> : |
46 | 49 | <JSONTree
|
47 |
| - data={axSnapshots[currLocation.index]} |
48 |
| - shouldExpandNodeInitially={() => true} |
49 |
| - theme={theme} |
50 |
| - /> |
51 |
| - )} |
52 |
| - </> |
53 |
| - ); |
| 50 | + data={axSnapshots[currLocation.index]} |
| 51 | + // shouldExpandNodeInitially={() => false} |
| 52 | + theme={theme} |
| 53 | + /> |
| 54 | + } |
| 55 | + </div> |
| 56 | + ) |
| 57 | + |
| 58 | + // return ( |
| 59 | + // <div> |
| 60 | + |
| 61 | + // <p>A Note to Developers: Reactime is using the Chrome Debugging API in order to grab the Accessibility Tree. Enabling this option will allow you to record AxSnapshots, but will result in the Chrome browser notifying you that the Chrome Debugger has started.</p> |
| 62 | + // {<button onClick={enableAxTreeButton}>Click Here to Enable Accessibility</button> |
| 63 | + // // <JSONTree |
| 64 | + // // data={axSnapshots[currLocation.index]} |
| 65 | + // // // shouldExpandNodeInitially={() => false} |
| 66 | + // // theme={theme} |
| 67 | + // // /> : null |
| 68 | + // } |
| 69 | + |
| 70 | + // </div> |
| 71 | + // ); |
54 | 72 | };
|
55 | 73 | export default AxTree;
|
0 commit comments