diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index 843c6dff9c08f..cd777f8333763 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -697,8 +697,8 @@ describe('InspectedElement', () => { expect(inspectedElement.props).toMatchInlineSnapshot(` { "anonymous_fn": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, "array_buffer": Dehydrated { "preview_short": ArrayBuffer(3), @@ -715,8 +715,8 @@ describe('InspectedElement', () => { "preview_long": 123n, }, "bound_fn": Dehydrated { - "preview_short": ƒ bound exampleFunction() {}, - "preview_long": ƒ bound exampleFunction() {}, + "preview_short": bound exampleFunction() {}, + "preview_long": bound exampleFunction() {}, }, "data_view": Dehydrated { "preview_short": DataView(3), @@ -727,8 +727,8 @@ describe('InspectedElement', () => { "preview_long": Tue Dec 31 2019 23:42:42 GMT+0000 (Coordinated Universal Time), }, "fn": Dehydrated { - "preview_short": ƒ exampleFunction() {}, - "preview_long": ƒ exampleFunction() {}, + "preview_short": exampleFunction() {}, + "preview_long": exampleFunction() {}, }, "html_element": Dehydrated { "preview_short":
, @@ -778,8 +778,8 @@ describe('InspectedElement', () => { "Symbol(name)": "hello", }, "proxy": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, "react_element": Dehydrated { "preview_short": , @@ -2018,16 +2018,16 @@ describe('InspectedElement', () => { { "proxy": { "$$typeof": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, "Symbol(Symbol.iterator)": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, "constructor": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, }, } diff --git a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js index 243759e5b02e7..d97c1897892f1 100644 --- a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js @@ -212,8 +212,8 @@ describe('InspectedElementContext', () => { expect(inspectedElement.props).toMatchInlineSnapshot(` { "anonymous_fn": Dehydrated { - "preview_short": ƒ () {}, - "preview_long": ƒ () {}, + "preview_short": () => {}, + "preview_long": () => {}, }, "array_buffer": Dehydrated { "preview_short": ArrayBuffer(3), @@ -230,8 +230,8 @@ describe('InspectedElementContext', () => { "preview_long": 123n, }, "bound_fn": Dehydrated { - "preview_short": ƒ bound exampleFunction() {}, - "preview_long": ƒ bound exampleFunction() {}, + "preview_short": bound exampleFunction() {}, + "preview_long": bound exampleFunction() {}, }, "data_view": Dehydrated { "preview_short": DataView(3), @@ -242,8 +242,8 @@ describe('InspectedElementContext', () => { "preview_long": Thu Jan 01 1970 00:00:00 GMT+0000 (Coordinated Universal Time), }, "fn": Dehydrated { - "preview_short": ƒ exampleFunction() {}, - "preview_long": ƒ exampleFunction() {}, + "preview_short": exampleFunction() {}, + "preview_long": exampleFunction() {}, }, "html_element": Dehydrated { "preview_short": , diff --git a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.css b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.css index d6851be672cff..0c0f5e852d9ee 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.css +++ b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.css @@ -34,8 +34,16 @@ overflow: hidden; text-overflow: ellipsis; flex: 1; + cursor: pointer; + border-radius: 0.125rem; + padding: 0px 2px; } +.Link:hover { + background-color: var(--color-background-hover); +} + + .ExpandCollapseToggleSpacer { flex: 0 0 1rem; width: 1rem; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js index 16e619cfb0847..af9e4b27e6181 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js @@ -27,7 +27,9 @@ import isArray from 'react-devtools-shared/src/isArray'; import {InspectedElementContext} from './InspectedElementContext'; import {PROTOCOLS_SUPPORTED_AS_LINKS_IN_KEY_VALUE} from './constants'; import KeyValueContextMenuContainer from './KeyValueContextMenuContainer'; +import {ContextMenuContext} from '../context'; +import type {ContextMenuContextType} from '../context'; import type {InspectedElement} from 'react-devtools-shared/src/frontend/types'; import type {Element} from 'react-devtools-shared/src/frontend/types'; import type {Element as ReactElement} from 'react'; @@ -91,6 +93,8 @@ export default function KeyValue({ const contextMenuTriggerRef = useRef(null); const {inspectPaths} = useContext(InspectedElementContext); + const {viewAttributeSourceFunction} = + useContext